Skip to content

Commit 5108f91

Browse files
authored
Merge pull request #11558 from Tharazi97/Coverity_fixes
Coverity fixes
2 parents 7eb8807 + a60df63 commit 5108f91

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

features/cellular/framework/common/CellularUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void prefer_ipv6(char *ip, size_t ip_size, char *ip2, size_t ip2_size)
236236
if (temp) {
237237
// ipv6 was found in ip2 but not in ip ---> we must swap them. Sadly ip and ip2 might not be pointers
238238
// so we can't just swap them, must use copy.
239-
if (strlen(ip) < ip2_size && strlen(ip2) < ip_size && strlen(ip) < 64) {
239+
if (strlen(ip) < ip2_size && strlen(ip2) < ip_size && strlen(ip) < 64 && strlen(ip2) < 64) {
240240
char tmp[64];
241241
strncpy(tmp, ip, strlen(ip));
242242
tmp[strlen(ip)] = '\0';

features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,9 @@ nsapi_size_or_error_t RM1000_AT_CellularStack::socket_recvfrom_impl(CellularSock
281281
} else {
282282
if (count == 0) {
283283
// Timeout with nothing received
284-
nsapi_error_size = NSAPI_ERROR_WOULD_BLOCK;
285284
success = false;
286285
}
287-
size = 0; // This simply to cause an exit
286+
break;
288287
}
289288
}
290289
timer.stop();

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,9 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
302302
} else {
303303
if (count == 0) {
304304
// Timeout with nothing received
305-
nsapi_error_size = NSAPI_ERROR_WOULD_BLOCK;
306305
success = false;
307306
}
308-
size = 0; // This simply to cause an exit
307+
break;
309308
}
310309
}
311310
} else if (socket->proto == NSAPI_TCP) {
@@ -346,10 +345,9 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
346345
} else {
347346
if (count == 0) {
348347
// Timeout with nothing received
349-
nsapi_error_size = NSAPI_ERROR_WOULD_BLOCK;
350348
success = false;
351349
}
352-
size = 0; // This simply to cause an exit
350+
break;
353351
}
354352
}
355353
}

features/frameworks/mbed-coap/source/sn_coap_builder.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -484,15 +484,6 @@ static uint8_t sn_coap_builder_options_calculate_jump_need(const sn_coap_hdr_s *
484484
}
485485
}
486486

487-
else {
488-
if (src_coap_msg_ptr->uri_path_ptr != 0) {
489-
previous_option_number = (COAP_OPTION_URI_PATH);
490-
}
491-
492-
if (src_coap_msg_ptr->content_format != COAP_CT_NONE) {
493-
previous_option_number = (COAP_OPTION_CONTENT_FORMAT);
494-
}
495-
}
496487
return needed_space;
497488
}
498489

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static void thread_parse_annoucement(protocol_interface_info_entry_t *cur, mle_m
514514
channel_page = ptr[0];
515515
channel = common_read_16_bit(&ptr[1]);
516516

517-
if (linkConfiguration->timestamp == timestamp) {
517+
if (linkConfiguration && linkConfiguration->timestamp == timestamp) {
518518
// We received same timestamp
519519
tr_debug("Same timestamp");
520520
return;
@@ -527,7 +527,7 @@ static void thread_parse_annoucement(protocol_interface_info_entry_t *cur, mle_m
527527
}
528528

529529

530-
if (linkConfiguration->timestamp > timestamp) {
530+
if (linkConfiguration && linkConfiguration->timestamp > timestamp) {
531531
// We received older time stamp we just announce back to originator channel
532532
thread_bootstrap_announce_send(cur, linkConfiguration->channel_page, linkConfiguration->rfChannel, linkConfiguration->panId, linkConfiguration->timestamp, channel);
533533
return;

0 commit comments

Comments
 (0)