From a6dcaa68a943c419e6d8fe93afd67c2d42bd5c22 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 16 Jul 2019 18:18:10 +0200 Subject: [PATCH] PVS V507: pointer to stack leaked to global variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I56740f4b847c0b99a44e7db830bcccb20bf51cbc Reviewed-on: https://review.haiku-os.org/c/1601 Reviewed-by: Stephan Aßmus --- src/bin/network/ping6/ping6.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/network/ping6/ping6.c b/src/bin/network/ping6/ping6.c index be26138f66..520047bfa8 100644 --- a/src/bin/network/ping6/ping6.c +++ b/src/bin/network/ping6/ping6.c @@ -1302,6 +1302,11 @@ pinger() i = sendmsg(s, &smsghdr, 0); + // as smsghdr is a global variable, don't let stray pointer to the stack + // in it after this function returns. + smsghdr.msg_iov = NULL; + smsghdr.msg_iovlen = 0; + if (i < 0 || i != cc) { if (i < 0) warn("sendmsg");