Skip to content

Coverity fixes #11558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/cellular/framework/common/CellularUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void prefer_ipv6(char *ip, size_t ip_size, char *ip2, size_t ip2_size)
if (temp) {
// ipv6 was found in ip2 but not in ip ---> we must swap them. Sadly ip and ip2 might not be pointers
// so we can't just swap them, must use copy.
if (strlen(ip) < ip2_size && strlen(ip2) < ip_size && strlen(ip) < 64) {
if (strlen(ip) < ip2_size && strlen(ip2) < ip_size && strlen(ip) < 64 && strlen(ip2) < 64) {
char tmp[64];
strncpy(tmp, ip, strlen(ip));
tmp[strlen(ip)] = '\0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,9 @@ nsapi_size_or_error_t RM1000_AT_CellularStack::socket_recvfrom_impl(CellularSock
} else {
if (count == 0) {
// Timeout with nothing received
nsapi_error_size = NSAPI_ERROR_WOULD_BLOCK;
success = false;
}
size = 0; // This simply to cause an exit
break;
}
}
timer.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,9 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
} else {
if (count == 0) {
// Timeout with nothing received
nsapi_error_size = NSAPI_ERROR_WOULD_BLOCK;
success = false;
}
size = 0; // This simply to cause an exit
break;
}
}
} else if (socket->proto == NSAPI_TCP) {
Expand Down Expand Up @@ -346,10 +345,9 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
} else {
if (count == 0) {
// Timeout with nothing received
nsapi_error_size = NSAPI_ERROR_WOULD_BLOCK;
success = false;
}
size = 0; // This simply to cause an exit
break;
}
}
}
Expand Down
9 changes: 0 additions & 9 deletions features/frameworks/mbed-coap/source/sn_coap_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,6 @@ static uint8_t sn_coap_builder_options_calculate_jump_need(const sn_coap_hdr_s *
}
}

else {
if (src_coap_msg_ptr->uri_path_ptr != 0) {
previous_option_number = (COAP_OPTION_URI_PATH);
}

if (src_coap_msg_ptr->content_format != COAP_CT_NONE) {
previous_option_number = (COAP_OPTION_CONTENT_FORMAT);
}
}
return needed_space;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static void thread_parse_annoucement(protocol_interface_info_entry_t *cur, mle_m
channel_page = ptr[0];
channel = common_read_16_bit(&ptr[1]);

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


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