From 93f9c56c325b0172fdd1781ff48e445ae438e052 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sat, 27 Jan 2018 14:45:17 +0100 Subject: [PATCH] fix bug #52976: lwip_ioctl() FIONREAD crash --- src/api/sockets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/sockets.c b/src/api/sockets.c index 11c94f39..da0d6c23 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -3726,7 +3726,7 @@ lwip_ioctl(int s, long cmd, void *argp) /* Check if there is data left from the last recv operation. /maq 041215 */ if (sock->lastdata.netbuf) { - if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) { + if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { recv_avail += sock->lastdata.pbuf->tot_len; } else { recv_avail += sock->lastdata.netbuf->p->tot_len;