From 63339677f8c656cf87ba1a4cb917db33f8e33472 Mon Sep 17 00:00:00 2001 From: nan-xiansen Date: Tue, 10 Aug 2021 14:42:38 +0800 Subject: [PATCH] =?UTF-8?q?fixed=207c22e87=20from=20https://gitee.com/ming?= =?UTF-8?q?xingyu/xts=5Facts/pulls/393=20=E3=80=90kernel=5Flite=E3=80=91?= =?UTF-8?q?=E3=80=90master=E3=80=91fix=20security=20alarm:net=5Fposix#Acts?= =?UTF-8?q?NetTest.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nan-xiansen Change-Id: I586c2db6ec128aea47d62d1e2f49614345862179 --- kernel_lite/net_posix/src/ActsNetTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel_lite/net_posix/src/ActsNetTest.cpp b/kernel_lite/net_posix/src/ActsNetTest.cpp index 7ed18c837..b769b054c 100755 --- a/kernel_lite/net_posix/src/ActsNetTest.cpp +++ b/kernel_lite/net_posix/src/ActsNetTest.cpp @@ -245,7 +245,7 @@ static void* SampleTcpServerTask(void *p) iov[0].iov_base = bufrec; iov[0].iov_len = sizeof(bufrec); ret = recvmsg(clnFd, &msg, 0); - if (len * strlen(g_cliMsg) == (unsigned int)ret) { + if (len * strlen(g_cliMsg) == (unsigned int)ret && ret >= 0) { bufrec[ret] = 0; printf("[tcp server]recvmsg on socket %d:%d, msg[%s]\n", clnFd, ret, buf); } else { -- GitLab