From d12e742373dff1d368b386649a4107d336661ed9 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 13 Nov 2011 17:06:19 +0100 Subject: [PATCH] Fixed bug #34733 Null pointer exception with SOCKET_DEBUG. --- src/api/sockets.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/api/sockets.c b/src/api/sockets.c index d83847fd..3bc96f97 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -758,10 +758,15 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags, ipX_addr_debug_print(NETCONNTYPE_ISIPV6(netconn_type(sock->conn)), SOCKETS_DEBUG, fromaddr); LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F" len=%d\n", port, off)); - if (*fromlen > saddr.sa.sa_len) { - *fromlen = saddr.sa.sa_len; +#if SOCKETS_DEBUG + if (from && fromlen) +#endif /* SOCKETS_DEBUG */ + { + if (*fromlen > saddr.sa.sa_len) { + *fromlen = saddr.sa.sa_len; + } + MEMCPY(from, &saddr, *fromlen); } - MEMCPY(from, &saddr, *fromlen); } }