File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
features/FEATURE_COMMON_PAL/mbed-coap/source Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -655,7 +655,7 @@ static int16_t sn_coap_parser_options_count_needed_memory_multiple_option(uint8_
655
655
uint16_t i = 1 ;
656
656
657
657
/* Loop all Uri-Query options */
658
- while (i <= packet_left_len ) {
658
+ while (i < packet_left_len ) {
659
659
if (option == COAP_OPTION_LOCATION_PATH && option_number_len > 255 ) {
660
660
return -1 ;
661
661
}
@@ -677,10 +677,14 @@ static int16_t sn_coap_parser_options_count_needed_memory_multiple_option(uint8_
677
677
678
678
i += option_number_len ;
679
679
ret_value += option_number_len + 1 ; /* + 1 is for separator */
680
+ if (ret_value >= packet_left_len )
681
+ break ;
680
682
681
- if ( i >= packet_left_len ) {
683
+ if (ret_value >= packet_left_len )
684
+ break ;
685
+
686
+ if ( i == packet_left_len )
682
687
break ;
683
- }
684
688
685
689
if ((* (packet_data_ptr + i ) >> COAP_OPTIONS_OPTION_NUMBER_SHIFT ) != 0 ) {
686
690
return (ret_value - 1 ); /* -1 because last Part path does not include separator */
You can’t perform that action at this time.
0 commit comments