Skip to content

Commit c1b72a7

Browse files
Fixed LWIP warning issues found by Coverity scan
1 parent 3801d4a commit c1b72a7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

features/lwipstack/lwip/src/api/lwip_api_msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
13321332
conn->state = NETCONN_NONE;
13331333
API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0);
13341334

1335-
if (was_blocking) {
1335+
if (was_blocking && op_completed_sem != NULL) {
13361336
sys_sem_signal(op_completed_sem);
13371337
}
13381338
return ERR_OK;

features/lwipstack/lwip/src/core/ipv4/lwip_ip4_frag.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ ip_reass_free_complete_datagram(struct ip_reassdata *ipr, struct ip_reassdata *p
206206
pbuf_free(pcur);
207207
}
208208
/* Then, unchain the struct ip_reassdata from the list and free it. */
209-
ip_reass_dequeue_datagram(ipr, prev);
209+
if (prev != NULL) {
210+
ip_reass_dequeue_datagram(ipr, prev);
211+
}
210212
LWIP_ASSERT("ip_reass_pbufcount >= pbufs_freed", ip_reass_pbufcount >= pbufs_freed);
211213
ip_reass_pbufcount = (u16_t)(ip_reass_pbufcount - pbufs_freed);
212214

@@ -660,8 +662,9 @@ ip4_reass(struct pbuf *p)
660662
}
661663

662664
/* release the sources allocate for the fragment queue entry */
663-
ip_reass_dequeue_datagram(ipr, ipr_prev);
664-
665+
if (ipr_prev != NULL) {
666+
ip_reass_dequeue_datagram(ipr, ipr_prev);
667+
}
665668
/* and adjust the number of pbufs currently queued for reassembly. */
666669
clen = pbuf_clen(p);
667670
LWIP_ASSERT("ip_reass_pbufcount >= clen", ip_reass_pbufcount >= clen);

features/lwipstack/lwip/src/core/lwip_dns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ dns_add_interface_server(u8_t numdns, const char *interface_name, const ip_addr_
431431
}
432432
// add new dns server to the list tail
433433
new_interface_server = mem_malloc(sizeof(struct dns_server_interface));
434-
strncpy(new_interface_server->interface_name, interface_name, INTERFACE_NAME_MAX_SIZE);
434+
snprintf(new_interface_server->interface_name, INTERFACE_NAME_MAX_SIZE, "%s",interface_name);
435435
new_interface_server->dns_servers[numdns] = (*dnsserver);
436436
new_interface_server->next = NULL;
437437

0 commit comments

Comments
 (0)