From bf1c7febb9f6c3a2336f18f658694393dea451ae Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Fri, 16 Jul 2021 14:44:03 +0800
Subject: [PATCH] [Huawei]gazelle: fix lwip_accept memcpy sockaddr larger than
 actual
---
 src/api/sockets.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/api/sockets.c b/src/api/sockets.c
index eccc7f9..e640945 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -860,6 +860,8 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
     if (*addrlen > tempaddr.sa.sa_len) {
       *addrlen = tempaddr.sa.sa_len;
     }
+#else
+        *addrlen = LWIP_MIN(*addrlen, sizeof(tempaddr));
 #endif /* USE_LIBOS */
     MEMCPY(addr, &tempaddr, *addrlen);
 
-- 
2.23.0

