From patchwork Sun Oct 8 10:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3379 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:b412:b0:f2:62eb:61c1 with SMTP id dj18csp1440889dyb; Sun, 8 Oct 2023 03:37:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtuTFh+2HJhgXOeXF8bZhRZuZUn79c3qNgOckZ03HK9U3Kc0Ddt7OiISB/BlM0idVz6oWc X-Received: by 2002:a05:6a21:a587:b0:163:c167:964a with SMTP id gd7-20020a056a21a58700b00163c167964amr16080023pzc.1.1696761433256; Sun, 08 Oct 2023 03:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696761433; cv=none; d=google.com; s=arc-20160816; b=YRqakUN67Q1dOwFUcKrHQi0PWSpaD+bqp1PTJPbpOFFBoSVCRY7q0KPtlR5hT+XCJ2 S1g2U6eWaFx/O11gyUdjWL24qcNDvV4rhzqiM1SpmVgPHdzz1F9pOWStyzQUCkjzFo9h /cwxGlOO9Yjh5t8ZF2k43lP9yT+XwyoVRWNdWWo6uLZqpG8zCWpdVuD8MfMJIoIV4hl5 qjxZphdJtymM/1rv3698pzlEH4bM5vJLmpj1xwjsd5TEuWND7tXvPv/yEKshoXZ3Pe6E 7b/I2sKnupjIt4spwmDpm071DZQTcvE7PQ0oL/qhg24Vjl3TCGqx4Lt+57ja/tuxBcur I1vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:cc:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=X/qzOOa/xKoHL0X19g2FLiFuY264OocFcozQTI62kYA=; fh=CfxSpwd5kfiMJoL3kcov7PTxVKT7pGe/79idnx9XlBs=; b=nvtY8meo9JxwGAjkHaizoCg0C9RyS7hoQqDO8wTkeC/AL+GPWSsKfSYAcW4Ts/jFwn TIbNqR/ZtCbDOQKMKaKZgAwlEbbvZVno4UohZ1jlcrrsVHmekbKTQENAy6uC7r8/XPE3 LoOIT79wNntuPJVmxzJpsQHr52H4IRf+hEZRi/654NCpD04AGUEudYKM2PUxdhz0sFW1 P0pNewIDWFpmaJbQj8sMNQxjXSh9S/G5aFu2/4hqNNbPJGry2vou/hJOOI9sSMLUZ92P IKb7ykjxIZdOoqvJnjJkH6Bu/JVbcP/14W9zwORUFNvgjINnszLtvEHeXP3oQLaBnfT6 WrMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=SJeLYDGD; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=JHTugjZb; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=j1C4BK3y; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id l195-20020a633ecc000000b0057e2432b366si7699518pga.378.2023.10.08.03.37.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Oct 2023 03:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=SJeLYDGD; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=JHTugjZb; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=j1C4BK3y; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net 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.95) (envelope-from ) id 1qpR9a-0002Cy-P1; Sun, 08 Oct 2023 10:36:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qpR9Z-0002Cr-S9 for openvpn-devel@lists.sourceforge.net; Sun, 08 Oct 2023 10:36:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/5bGsH/kBk6WIhYadPFRVNUC+RGwUMU6/WpnNphfdpY=; b=SJeLYDGDPPhuOxG4RHwtzp48b3 7ZwvC2m+2FhPaoYerRVIqyYPJrf7FFM1g6RJMx/NlwZIM4okDmjJk6n87q3tXu9OWe0clOms961iK KRl0/0U8w7yIA919Vsq5CMG1pPDN0phaoU+X7JIGa/4TT1wg8c3xQy4rAFLGJUAZnWyY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=/5bGsH/kBk6WIhYadPFRVNUC+RGwUMU6/WpnNphfdpY=; b=JHTugjZbuldlNgKnXH5V32ilkQ mV5zdlTQHIV37B8wTWUVhUJWdLxvUQ53a31tGrxJ4W1zescwa44G/iLk1jxuWQr0o2jKPkePJBmL1 rylfk5eVgvreOJfOzlQt0UxYRN6hS/xUpXu8bu31LOmqyqJzwOHby6Jrjp1pKSzwaVTs=; Received: from mout-p-101.mailbox.org ([80.241.56.151]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qpR9Y-0000Kz-EQ for openvpn-devel@lists.sourceforge.net; Sun, 08 Oct 2023 10:36:54 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4S3JVy4nGjz9sTH; Sun, 8 Oct 2023 12:36:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1696761402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/5bGsH/kBk6WIhYadPFRVNUC+RGwUMU6/WpnNphfdpY=; b=j1C4BK3ybQVNsCEbO9u9vUj3Vx3O6aOZmQmS0T2O4GDSVrDVtukO4g0Nhe7Mc2SrnOPi98 xd/2ub06vwHI01bhQ9guvptxf1s5bHpLLjzWFPQxRKij6/KCL8UL0QiKo6xhOlUgxnmD41 LngLJ3kEPqoCrChMlq5vTrGqY84nTv7Alnhl5aYdLi13tPVR5eR61YY8OMZI0kyou7YeMz tXAmw1OzatAOh3rUWOxYAzNqaOX+ecjtG4r9bQWRXLaOrThItuMCJ9hsV0td5F4IJrtIDx LQY0va9459O5D+Li8gwKVqIZhzpjtWzjPzerDktgPX6gm1MpoKwCFasTY2MsvQ== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Sun, 8 Oct 2023 12:36:41 +0200 Message-Id: <20231008103641.19864-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: These are all not actually problems, since the uninitialized parts are either .unused members of the struct (mroute_addr) or only written to (buflen), but still doesn't hurt to explicitely initialize [...] Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.151 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1qpR9Y-0000Kz-EQ Subject: [Openvpn-devel] [PATCH] Fix various "Uninitialized scalar variable" warnings from Coverity 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: , Cc: Arne Schwabe Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1779183316473213678?= X-GMAIL-MSGID: =?utf-8?q?1779183316473213678?= These are all not actually problems, since the uninitialized parts are either .unused members of the struct (mroute_addr) or only written to (buflen), but still doesn't hurt to explicitely initialize them. Change-Id: I45cd0917d24570ae9e9db7eb6c370756e4595842 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/318 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 81625ea..e6c99ae 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -188,7 +188,7 @@ multi_get_create_instance_udp(struct multi_context *m, bool *floated) { struct gc_arena gc = gc_new(); - struct mroute_addr real; + struct mroute_addr real = {0}; struct multi_instance *mi = NULL; struct hash *hash = m->hash; diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index aad11b1..728a7b8 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -1234,7 +1234,7 @@ bool primary) { struct openvpn_sockaddr remote_si; - struct mroute_addr addr; + struct mroute_addr addr = {0}; CLEAR(remote_si); remote_si.addr.in4.sin_family = AF_INET; @@ -1273,7 +1273,7 @@ int netbits, /* -1 if host route, otherwise # of network bits in address */ bool primary) { - struct mroute_addr addr; + struct mroute_addr addr = {0}; addr.len = 16; addr.type = MR_ADDR_IPV6; @@ -3118,7 +3118,7 @@ void multi_process_float(struct multi_context *m, struct multi_instance *mi) { - struct mroute_addr real; + struct mroute_addr real = {0}; struct hash *hash = m->hash; struct gc_arena gc = gc_new(); @@ -3532,7 +3532,7 @@ if (BLEN(&m->top.c2.buf) > 0) { unsigned int mroute_flags; - struct mroute_addr src, dest; + struct mroute_addr src = {0}, dest = {0}; const int dev_type = TUNNEL_TYPE(m->top.c1.tuntap); int16_t vid = 0; diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c index 40080ef..0ddabc7 100644 --- a/src/openvpn/pkcs11_openssl.c +++ b/src/openvpn/pkcs11_openssl.c @@ -166,7 +166,7 @@ CK_RSA_PKCS_PSS_PARAMS pss_params = {0}; unsigned char buf[EVP_MAX_MD_SIZE]; - size_t buflen; + size_t buflen = 0; size_t siglen_max = *siglen; unsigned char enc[EVP_MAX_MD_SIZE + 32]; /* 32 bytes enough for DigestInfo header */ diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 2d765cc..58231fb 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3301,7 +3301,7 @@ { struct iovec iov; uint8_t pktinfo_buf[PKTINFO_BUF_SIZE]; - struct msghdr mesg; + struct msghdr mesg = {0}; socklen_t fromlen = sizeof(from->dest.addr); ASSERT(sock->sd >= 0); /* can't happen */