11 Star 76 Fork 99

OpenHarmony / third_party_lwip

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0076-fix-recvmsg-return-EINVAL.patch 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
Aurora 提交于 2023-12-07 03:26 . update lwip to 2.1.3-39.oe2203sp1
From 92091a697ae8dac4026fd75a421ad9464aaa253e Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Wed, 25 Oct 2023 15:44:19 +0800
Subject: [PATCH 76/77] fix recvmsg return EINVAL
---
src/api/sockets.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index b6c7b05..1d71427 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1492,9 +1492,21 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
/* check for valid vectors */
buflen = 0;
for (i = 0; i < message->msg_iovlen; i++) {
+#if GAZELLE_ENABLE
+ /* msg_iov[i].iov_len == 0 dont return ERRVAL
+ * According to the Single Unix Specification we should return EINVAL if an elment length is < 0
+ * when cast to ssize_t
+ */
+ if ((message->msg_iov[i].iov_base == NULL) || ((ssize_t)message->msg_iov[i].iov_len < 0) ||
+#else
if ((message->msg_iov[i].iov_base == NULL) || ((ssize_t)message->msg_iov[i].iov_len <= 0) ||
+#endif
((size_t)(ssize_t)message->msg_iov[i].iov_len != message->msg_iov[i].iov_len) ||
+#if GAZELLE_ENABLE
+ ((ssize_t)(buflen + (ssize_t)message->msg_iov[i].iov_len) < 0)) {
+#else
((ssize_t)(buflen + (ssize_t)message->msg_iov[i].iov_len) <= 0)) {
+#endif
sock_set_errno(sock, err_to_errno(ERR_VAL));
done_socket(sock);
return -1;
--
2.27.0
1
https://gitee.com/openharmony/third_party_lwip.git
git@gitee.com:openharmony/third_party_lwip.git
openharmony
third_party_lwip
third_party_lwip
master

搜索帮助