Skip to content

Commit f51329b

Browse files
Yogesh PandeYogesh Pande
authored andcommitted
Reverting fix for IOTCLT-1439 because of regression
1 parent 9f8271e commit f51329b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_parser.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ static int16_t sn_coap_parser_options_count_needed_memory_multiple_option(uint8_
655655
uint16_t i = 1;
656656

657657
/* Loop all Uri-Query options */
658-
while (i <= packet_left_len) {
658+
while (i < packet_left_len) {
659659
if (option == COAP_OPTION_LOCATION_PATH && option_number_len > 255) {
660660
return -1;
661661
}
@@ -677,10 +677,14 @@ static int16_t sn_coap_parser_options_count_needed_memory_multiple_option(uint8_
677677

678678
i += option_number_len;
679679
ret_value += option_number_len + 1; /* + 1 is for separator */
680+
if(ret_value >= packet_left_len)
681+
break;
680682

681-
if( i >= packet_left_len ) {
683+
if(ret_value >= packet_left_len)
684+
break;
685+
686+
if( i == packet_left_len )
682687
break;
683-
}
684688

685689
if ((*(packet_data_ptr + i) >> COAP_OPTIONS_OPTION_NUMBER_SHIFT) != 0) {
686690
return (ret_value - 1); /* -1 because last Part path does not include separator */

0 commit comments

Comments
 (0)