From 54c1025ec0ff5bbad1dddf6e11cbd5c6c0cb90de Mon Sep 17 00:00:00 2001 From: fbernon Date: Mon, 27 Aug 2007 10:08:53 +0000 Subject: [PATCH] First fix for "bug #20900 : Potential crash error problem with netconn_peer & netconn_addr". Introduce NETCONN_LISTEN netconn_state and remove obsolete ones (NETCONN_RECV & NETCONN_ACCEPT). --- CHANGELOG | 5 +++++ src/api/api_lib.c | 2 +- src/api/api_msg.c | 1 + src/include/lwip/api.h | 3 +-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 91097e1f..867d5d9a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -312,6 +312,11 @@ HISTORY ++ Bug fixes: + 2007-08-27 Frédéric Bernon + * api.h, api_lib.c, api_msg.c: First fix for "bug #20900 : Potential crash error + problem with netconn_peer & netconn_addr". Introduce NETCONN_LISTEN netconn_state + and remove obsolete ones (NETCONN_RECV & NETCONN_ACCEPT). + 2007-08-24 Kieran Mansley * inet.c Modify (acc >> 16) test to ((acc >> 16) != 0) to help buggy compiler (Paradigm C++) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 263bbdaf..0f60d36b 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -594,7 +594,7 @@ netconn_recv(struct netconn *conn) if (conn->type == NETCONN_TCP) { #if LWIP_TCP - if (conn->pcb.tcp->state == LISTEN) { + if (conn->state == NETCONN_LISTEN) { conn->err = ERR_CONN; return NULL; } diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 27ae91f3..1c4c29a2 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -676,6 +676,7 @@ do_listen(struct api_msg_msg *msg) } } if (msg->conn->err == ERR_OK) { + msg->conn->state = NETCONN_LISTEN; msg->conn->pcb.tcp = lpcb; tcp_arg(msg->conn->pcb.tcp, msg->conn); tcp_accept(msg->conn->pcb.tcp, accept_function); diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index 3ba0f3aa..330498d0 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -74,8 +74,7 @@ enum netconn_type { enum netconn_state { NETCONN_NONE, NETCONN_WRITE, - NETCONN_ACCEPT, - NETCONN_RECV, + NETCONN_LISTEN, NETCONN_CONNECT, NETCONN_CLOSE };