| Message ID | 20220107123550.188-1-lstipakov@gmail.com |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director14.mail.ord1d.rsapps.net ([172.31.255.6]) by backend41.mail.ord1d.rsapps.net with LMTP id ICsrIPYz2GHueQAAqwncew (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Fri, 07 Jan 2022 07:37:10 -0500 Received: from proxy4.mail.iad3b.rsapps.net ([172.31.255.6]) by director14.mail.ord1d.rsapps.net with LMTP id OIQgAPcz2GGOZQAAeJ7fFg (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Fri, 07 Jan 2022 07:37:11 -0500 Received: from smtp38.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.iad3b.rsapps.net with LMTPS id 4B6JNvYz2GH/SQAA9crAow (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Fri, 07 Jan 2022 07:37:10 -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: smtp38.gate.iad3b.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; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 881c6d3e-6fb6-11ec-8d84-5254006f0979-1-1 Received: from [216.105.38.7] ([216.105.38.7:47200] helo=lists.sourceforge.net) by smtp38.gate.iad3b.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 7B/82-22704-6F338D16; Fri, 07 Jan 2022 07:37:10 -0500 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1n5oTe-0006WO-BN; Fri, 07 Jan 2022 12:36:13 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <lstipakov@gmail.com>) id 1n5oTd-0006WI-0S for openvpn-devel@lists.sourceforge.net; Fri, 07 Jan 2022 12:36:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: 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=OaCiwirtI9pPLzGRM8blB0DfM5Ma9rUTm5A1KYU8Ssg=; b=cH9IWW/0GY8/81zY5kIbwLzYwu bCEw69kyza13O58kkvdvRW7v/I3uqInbIzRwC0+ackw4oChoUCsFvzVKW4W2HRXg9mIBmdZmqCV7k AWwJD6JJN6XTmhxnmn30OuKMFWfd1SMYCTeU0X2IkeZM2dILHV+RBNgZtIkEEwzJ5gIk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: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=OaCiwirtI9pPLzGRM8blB0DfM5Ma9rUTm5A1KYU8Ssg=; b=jyxo1kq2d5JhAv7NnN3JGcG2Af fcFaApq2VHoXGZJ6eK4YjaESd02YHcLbzEc+GazHhBeWSqgZVbnHU4xrWvVoW+xZqjmMG1nT3dkq1 m7I68WDD3ow8t5Zxl+mXNFAW+1nTHEQnfQbbvWc30cXQ2XVAdZKQmWNh9Cg7NtPAgfKM=; Received: from mail-lf1-f46.google.com ([209.85.167.46]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) id 1n5oTY-0055yl-NH for openvpn-devel@lists.sourceforge.net; Fri, 07 Jan 2022 12:36:12 +0000 Received: by mail-lf1-f46.google.com with SMTP id i31so14978736lfv.10 for <openvpn-devel@lists.sourceforge.net>; Fri, 07 Jan 2022 04:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=OaCiwirtI9pPLzGRM8blB0DfM5Ma9rUTm5A1KYU8Ssg=; b=BwKgP6kogyxyw6VCslyP+haCD2QbB8RD3fzKUYWSA565ixaqtGr2Bthh/YA1c0ES8U IibHTfDGTpHQ70wecncaUNZt9bo05/FT07m75PwPuZ+CkdFom/844Lp6xLCHfMCNLww+ iaqSoDznN56tI+gxx4YXXF5pTPyv5WRz5lmubXsUhHQMeXzS9fQqJJ7T/zTokdp6essB /dV/nBrx4zagHFvipXSiQGyP/6jlDzWl6nVDxgjiZMFBTavSGAwcRXHfSa5SM3fPocu2 fzKMzbqaLu6+jo5ysoUj00X75LZqkA7rdZDDhBph1NPQNL7mFZKX1uiijPuraMwP7xND +zgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OaCiwirtI9pPLzGRM8blB0DfM5Ma9rUTm5A1KYU8Ssg=; b=JnKiG6fV4mVEEUutF8VXYXQ51dfyaUuOpRhPkZ5HuBR/x/xAmunZMnIisue77RgEqW F9bFD5hteWEaj3bQPONJh9D3cmAqizEgbY5FGzehzIzlXcLChmN2UGR7IKeX9P0KBfXB aUD86sj537mEntAgpmnCkOlu4RiCJUxfRv2waPUaaFTXX5zYYfP7XoyN9/eiBp4+5z3k Yi3Pevi/HIDh5zgt2C4orIYwgN0yBMOOYw79TjK+PKsCy99hZ40Z0xPsEzq1yXRzMWEm 1uE5sRBeWUy6CXb+QMp70tu+eenTEPIbn3WawUmX0YVLMPAXT5exCRE4kAtE6+PP8CPv 0ibA== X-Gm-Message-State: AOAM533gcu76alKB7b1K+eSooulTSCMUHDYqW4ClsrJyOEcapLP2rpZB IFs8EipXYoT/2G7qupk3hQbBBi1h+V4cIw== X-Google-Smtp-Source: ABdhPJzJYX/9IQJ+B2HYVr0myPYMuZSZR+6Ma8QkRwxgFskmbFU08pO1kYUyDYuj1FdQNTpHvaSCuA== X-Received: by 2002:a2e:884a:: with SMTP id z10mr50709363ljj.487.1641558961865; Fri, 07 Jan 2022 04:36:01 -0800 (PST) Received: from LAPTOP-4L3N7KFS.localdomain (176-93-145-150.bb.dnainternet.fi. [176.93.145.150]) by smtp.gmail.com with ESMTPSA id x15sm566818lfd.23.2022.01.07.04.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 04:36:01 -0800 (PST) From: Lev Stipakov <lstipakov@gmail.com> To: openvpn-devel@lists.sourceforge.net Date: Fri, 7 Jan 2022 14:35:50 +0200 Message-Id: <20220107123550.188-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 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: From: Lev Stipakov This fixes error C4703: potentially uninitialized local pointer variable 'b64output' used Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.46 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [lstipakov[at]gmail.com] -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.46 listed in wl.mailspike.net] X-Headers-End: 1n5oTY-0055yl-NH Subject: [Openvpn-devel] [PATCH] auth_token.c: add NULL initialization X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> Cc: Lev Stipakov <lev@openvpn.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] auth_token.c: add NULL initialization
|
|
Commit Message
Lev Stipakov
Jan. 7, 2022, 1:35 a.m. UTC
From: Lev Stipakov <lev@openvpn.net> This fixes error C4703: potentially uninitialized local pointer variable 'b64output' used found by arm64 msvc compiler with SDL enabled. Not sure why this is not triggered on x86/x64. Signed-off-by: Lev Stipakov <lev@openvpn.net> --- src/openvpn/auth_token.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi, On 07/01/2022 13:35, Lev Stipakov wrote: > From: Lev Stipakov <lev@openvpn.net> > > This fixes > > error C4703: potentially uninitialized local pointer variable 'b64output' used > > found by arm64 msvc compiler with SDL enabled. > > Not sure why this is not triggered on x86/x64. > > Signed-off-by: Lev Stipakov <lev@openvpn.net> > --- > src/openvpn/auth_token.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c > index e8875464..ceae68f6 100644 > --- a/src/openvpn/auth_token.c > +++ b/src/openvpn/auth_token.c > @@ -259,7 +259,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi) > ASSERT(buf_write(&token, ×tamp, sizeof(timestamp))); > ASSERT(buf_write(&token, hmac_output, sizeof(hmac_output))); > > - char *b64output; > + char *b64output = NULL; > openvpn_base64_encode(BPTR(&token), BLEN(&token), &b64output); It's impossible to leave b64output uninitialized, but the compiler is probably not smart enough to understand it. On the other hand, passing uninitialized variables by reference to a function (without checking its return value) and using them later is never a good pattern.. Acked-by: Antonio Quartulli <a@unstable.cc>
Am 07.01.22 um 13:35 schrieb Lev Stipakov: > From: Lev Stipakov <lev@openvpn.net> > > This fixes > > error C4703: potentially uninitialized local pointer variable 'b64output' used > > found by arm64 msvc compiler with SDL enabled. > > Not sure why this is not triggered on x86/x64. > > Signed-off-by: Lev Stipakov <lev@openvpn.net> > --- > src/openvpn/auth_token.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c > index e8875464..ceae68f6 100644 > --- a/src/openvpn/auth_token.c > +++ b/src/openvpn/auth_token.c > @@ -259,7 +259,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi) > ASSERT(buf_write(&token, ×tamp, sizeof(timestamp))); > ASSERT(buf_write(&token, hmac_output, sizeof(hmac_output))); > > - char *b64output; > + char *b64output = NULL; > openvpn_base64_encode(BPTR(&token), BLEN(&token), &b64output); > > struct buffer session_token = alloc_buf_gc( Fine with me Acked-By: Arne Schwabe <arne@rfc2549.org>
Your patch has been applied to the master and release/2.5 branch.
I have not done real testing, as it's quite obvious what it's doing :)
commit 4b6073b8253dafeb425361fb55bab0f2cdc5474f (master)
commit 813d1ee3c8b6a914599e4705eee3b8835d606e4b (release/2.5)
Author: Lev Stipakov
Date: Fri Jan 7 14:35:50 2022 +0200
auth_token.c: add NULL initialization
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220107123550.188-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23511.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c index e8875464..ceae68f6 100644 --- a/src/openvpn/auth_token.c +++ b/src/openvpn/auth_token.c @@ -259,7 +259,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi) ASSERT(buf_write(&token, ×tamp, sizeof(timestamp))); ASSERT(buf_write(&token, hmac_output, sizeof(hmac_output))); - char *b64output; + char *b64output = NULL; openvpn_base64_encode(BPTR(&token), BLEN(&token), &b64output); struct buffer session_token = alloc_buf_gc(