From patchwork Tue Jan 5 02:17:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1559 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.50]) by backend30.mail.ord1d.rsapps.net with LMTP id uCHLI1Nn9F/beAAAIUCqbw (envelope-from ) for ; Tue, 05 Jan 2021 08:19:15 -0500 Received: from proxy12.mail.iad3a.rsapps.net ([172.27.255.50]) by director9.mail.ord1d.rsapps.net with LMTP id mMt4I1Nn9F+tRAAAalYnBA (envelope-from ) for ; Tue, 05 Jan 2021 08:19:15 -0500 Received: from smtp15.gate.iad3a ([172.27.255.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy12.mail.iad3a.rsapps.net with LMTPS id mBe6HVNn9F8EcwAAh9K5Vw (envelope-from ) for ; Tue, 05 Jan 2021 08:19:15 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp15.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 9adce48c-4f58-11eb-b3bf-525400f46865-1-1 Received: from [216.105.38.7] ([216.105.38.7:59810] helo=lists.sourceforge.net) by smtp15.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id D8/5B-24765-25764FF5; Tue, 05 Jan 2021 08:19:14 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kwmEE-0007lk-FG; Tue, 05 Jan 2021 13:18:26 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwmEC-0007lZ-TT for openvpn-devel@lists.sourceforge.net; Tue, 05 Jan 2021 13:18:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LDojilNrfAXLYdNP1++WcmnxUmKCd690KNf9pWZbLvI=; b=OQTJ/tEnP83dbRBVNp9dpGLpq6 2jJR51sLQkoOxxlVLz6/p2maXRlGweRU5wEBHxzZFEtlVCvgVXzYoGKe4bzUHWODZel4xeOhInmGh O0l+kgUuAoTQg/ksqsocSfNn8zekwRluHC0G2B66xRKN9/KjZhbgTCGLqJ/6Br7CQ0Ws=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=LDojilNrfAXLYdNP1++WcmnxUmKCd690KNf9pWZbLvI=; b=NtDVkZIi9rjI5jGAoZ6MQ7kNWu EihNLY7fY5XNTGSv6hwUZ35oXqq0PArb5zkoPxZElY5whUZ6mbX6BkSJHDLqpozPydf8z6VDA60Rf qqqZxxjdOiBifpVmlNv/UANlvgjLpsa9TgXcsea3U+2m3Ey5SpyLYrBeZyI18EXKPhy0=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kwmE7-00GCg4-DM for openvpn-devel@lists.sourceforge.net; Tue, 05 Jan 2021 13:18:24 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1kwmDm-0009th-Rm for openvpn-devel@lists.sourceforge.net; Tue, 05 Jan 2021 14:17:58 +0100 Received: (nullmailer pid 20356 invoked by uid 10006); Tue, 05 Jan 2021 13:17:58 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Tue, 5 Jan 2021 14:17:58 +0100 Message-Id: <20210105131758.20311-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1kwmE7-00GCg4-DM Subject: [Openvpn-devel] [PATCH] Zero initialise msghdr prior to calling sendmesg X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox This ensure that all unused fields in msg are zero. Spotted by Coverity: Using uninitialized value "msg". Field "msg.msg_flags" is uninitialized when calling "sendmsg". --- src/openvpn/manage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index a4f99c9a..103ccadc 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -2092,7 +2092,7 @@ man_io_error(struct management *man, const char *prefix) static ssize_t man_send_with_fd(int fd, void *ptr, size_t nbytes, int flags, int sendfd) { - struct msghdr msg; + struct msghdr msg = {0}; struct iovec iov[1]; union { @@ -2124,7 +2124,7 @@ man_send_with_fd(int fd, void *ptr, size_t nbytes, int flags, int sendfd) static ssize_t man_recv_with_fd(int fd, void *ptr, size_t nbytes, int flags, int *recvfd) { - struct msghdr msghdr; + struct msghdr msghdr = {0}; struct iovec iov[1]; ssize_t n;