From 0e2354e658d9dc193d60048a8394517a41ca64ff Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 28 Sep 2016 12:53:07 +0200 Subject: [PATCH] Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer --- src/api/api_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 9dfea64e..8b7a6bd9 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -780,7 +780,8 @@ netconn_drain(struct netconn *conn) /* Delete and drain the acceptmbox. */ #if LWIP_TCP if (sys_mbox_valid(&conn->acceptmbox)) { - while (sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) { + while ((sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) && + (mem != &netconn_aborted)) { struct netconn *newconn = (struct netconn *)mem; /* Only tcp pcbs have an acceptmbox, so no need to check conn->type */ /* pcb might be set to NULL already by err_tcp() */