1 Star 0 Fork 100

hos-learning / third_party_lwip

forked from OpenHarmony / third_party_lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0093-modfiy-accept-null-pointer-when-new-conn-receive-RST-packet-in-listening.patch 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
Aurora 提交于 2024-03-28 16:36 . update lwip from 2.1.3-90 to 2.1.3-102
From dcdd7d73c6083a63fe966a68f11eddcafa3fd743 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Thu, 14 Dec 2023 14:51:37 +0800
Subject: [PATCH] resove null pointer
---
src/api/sockets.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index a9d39ae..0b3e4ea 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -801,15 +801,17 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
#endif /* GAZELLE_ENABLE */
nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
#if GAZELLE_ENABLE
+ int ret = 0;
struct tcp_pcb *pcb = newconn->pcb.tcp;
- if (pcb->client_rx_ring != NULL && pcb->client_tx_ring != NULL) {
- if (find_same_node_memzone(pcb, nsock) != 0) {
+ if (pcb != NULL && pcb->client_rx_ring != NULL && pcb->client_tx_ring != NULL) {
+ ret = find_same_node_memzone(pcb, nsock);
+ }
+ if (pcb == NULL || ret != 0) {
netconn_delete(newconn);
free_socket(nsock, 1);
sock_set_errno(sock, ENOTCONN);
done_socket(sock);
return -1;
- }
}
#endif
--
2.33.0
1
https://gitee.com/hos-learning/third_party_lwip.git
git@gitee.com:hos-learning/third_party_lwip.git
hos-learning
third_party_lwip
third_party_lwip
master

搜索帮助