From 8e1c0fc187129898df8bf2632659009cf2dbf84f Mon Sep 17 00:00:00 2001 From: junmin kim Date: Wed, 27 Sep 2017 03:53:03 -0700 Subject: [PATCH] Add NULL check in send_tcp function Pointer 'conn' which was dereferenced at api_msg.c:330 is compared to NULL value at api_msg.c:336. If conn is NULL, ERR_ARG will be returned. --- os/net/lwip/src/api/api_msg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/os/net/lwip/src/api/api_msg.c b/os/net/lwip/src/api/api_msg.c index 94b6eee..70b5e07 100644 --- a/os/net/lwip/src/api/api_msg.c +++ b/os/net/lwip/src/api/api_msg.c @@ -327,6 +327,10 @@ static err_t sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len) LWIP_UNUSED_ARG(pcb); LWIP_ASSERT("conn != NULL", (conn != NULL)); + if (conn == NULL) { + return ERR_ARG; + } + if (conn->state == NETCONN_WRITE) { do_writemore(conn); } else if (conn->state == NETCONN_CLOSE) { -- 2.7.4