From 22e602debbc9df0503562d1eb7902f7ef9d6886f Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 21 Dec 2018 12:50:52 +0000 Subject: [PATCH] Check for NULL in tcp_recved_tcpip() CL: Check for NULL in tcp_recved_tcpip() PUBLISHED_FROM=3f5bbc2e35b79d363eac4b99a1f0d17c9b81d4ec --- mongoose.c | 2 +- src/common/platforms/lwip/mg_lwip_net_if.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 710ded3d..325bbb35 100644 --- a/mongoose.c +++ b/mongoose.c @@ -15724,7 +15724,7 @@ struct tcp_recved_ctx { void tcp_recved_tcpip(void *arg) { struct tcp_recved_ctx *ctx = (struct tcp_recved_ctx *) arg; - tcp_recved(ctx->tpcb, ctx->len); + if (ctx->tpcb != NULL) tcp_recved(ctx->tpcb, ctx->len); } static int mg_lwip_if_tcp_recv(struct mg_connection *nc, void *buf, diff --git a/src/common/platforms/lwip/mg_lwip_net_if.c b/src/common/platforms/lwip/mg_lwip_net_if.c index d0777029..e78d93ce 100644 --- a/src/common/platforms/lwip/mg_lwip_net_if.c +++ b/src/common/platforms/lwip/mg_lwip_net_if.c @@ -581,7 +581,7 @@ struct tcp_recved_ctx { void tcp_recved_tcpip(void *arg) { struct tcp_recved_ctx *ctx = (struct tcp_recved_ctx *) arg; - tcp_recved(ctx->tpcb, ctx->len); + if (ctx->tpcb != NULL) tcp_recved(ctx->tpcb, ctx->len); } static int mg_lwip_if_tcp_recv(struct mg_connection *nc, void *buf,