From patchwork Wed Feb 19 13:49:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 1013 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id MKp7LPXXTV6zcwAAIUCqbw for ; Wed, 19 Feb 2020 19:51:01 -0500 Received: from proxy19.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id IBpOLPXXTV5iTAAAfY0hYg ; Wed, 19 Feb 2020 19:51:01 -0500 Received: from smtp11.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.ord1d.rsapps.net with LMTP id MN8KLPXXTV6pVgAAyH2SIw ; Wed, 19 Feb 2020 19:51:01 -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: smtp11.gate.ord1d.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: 669782ec-537b-11ea-a047-5254005f837b-1-1 Received: from [216.105.38.7] ([216.105.38.7:41018] helo=lists.sourceforge.net) by smtp11.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 15/41-19505-688DD4E5; Wed, 19 Feb 2020 19:53:26 -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 1j4a2L-0004Z4-7q; Thu, 20 Feb 2020 00:49:53 +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 1j4a2J-0004Yr-7A for openvpn-devel@lists.sourceforge.net; Thu, 20 Feb 2020 00:49:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: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=QzwV27pN37w5FF/n5eJ+37X+i9o9XG+elhZTnwKt/f4=; b=QIh7SF9jxzJvlx7TObA6UR8LFR GzHp3hwsST1RSMSqdeArSpurGEIrmSB0OqPy9RsN86YGmShUVVaMimIFXZrufif6TODAg3MJXFBIp 3w2oV7ar0As5KbvaQSF544dzDZrapwbAvg2aM9f7k56SHniDJuyvpgeCp/HUKAziALO4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To: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=QzwV27pN37w5FF/n5eJ+37X+i9o9XG+elhZTnwKt/f4=; b=a rL7j9X6Ktj5EkFf/b4Jtr/etgpPDbRekJMwnKrn7biaXuppaRjQltZbjHU1kwFcE7ykCkEwvKuZCK 66QzGxKwINjHl+emwFNVXunj3JiFt3lQxJlzOE2yvjBuTVAX2GQdldGNidTqDrGMD7PuOD3b+9DTk iXyCB/ixc7Tb0sX8=; Received: from mail-qv1-f68.google.com ([209.85.219.68]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1j4a2H-008BH5-B0 for openvpn-devel@lists.sourceforge.net; Thu, 20 Feb 2020 00:49:51 +0000 Received: by mail-qv1-f68.google.com with SMTP id p2so1108528qvo.10 for ; Wed, 19 Feb 2020 16:49:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QzwV27pN37w5FF/n5eJ+37X+i9o9XG+elhZTnwKt/f4=; b=nDMqrR7BXZzNah+5jSSpyuzwc9AM0mGlU3bKvXPOXik4GkKxwgzXGyl9kP5/3nMgAz MLFOEKglVa7W0AuG5hDzVlh8LpML1UXug7NfCdZuZkzgEZss78AofZlBec0m1rcR6mGs 5xM0mXlzhGNM2xbNc1jU7tmspZlErCRaTAnuZ3yJJXRLHnUQ0rKS02SsToy2aPHw1w46 hHHJrCBJZhLzIB4wK209l+DZLT0kseZtrpeD3oIPLCwr+H9SFHPK9BZIQVvXPxMlX3Cn y4Mu+IS3Mi5T0lG1lXE1NczVFN4l5EYg2cVjFBYh577l60ojQaKCyk3dtrYE8MHPnFjf ZyYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QzwV27pN37w5FF/n5eJ+37X+i9o9XG+elhZTnwKt/f4=; b=c/au1Sp/YuoQQD84mGc4FhmLKUzUZ2DNtuKOrcIRQinDQm3zud34vHT6aHiaQRfSUI YKWOlorXsyDKo5yO3zc2AIg41HVXfHv1DRdvTjk2DnWV7KZ0EyMqzwwDmRBKi4/edfPF JM2gzitqBpUDmMHtzsWc36dOGw9ROs3iXcGO/ZhKviMsSsqHbc+YK1G++idki3evQweR IPm/UuTqcX68UOVZNO7DMaj7OscTYoDOlY2IZhvcxOs4Vh1V9j+k1SEfTUzo0T1BvzQ6 ANJ83aLHnPT2CqSeTF9ZVbIonGmEBs9AkCp2o0sNd7iKJNbti5hoiC8076rf8k46YKiG kTQA== X-Gm-Message-State: APjAAAVye5hqi9tTtVNv8FIbY1ntRE4SvRoVU8MjNAPHVT0bpDx+41Lr m9jZl3r/cr89y9Z3byo0fu3e8exn3ok= X-Google-Smtp-Source: APXvYqyElxbBAP+m1lhcnEmCM2T1KPO1E5G0iAHOEkv5uwnD2XEr+QkcLmz64YHEvjHaNkICawj5mg== X-Received: by 2002:a05:6214:38c:: with SMTP id l12mr23268682qvy.224.1582159783218; Wed, 19 Feb 2020 16:49:43 -0800 (PST) Received: from saturn.home.sansel.ca (CPE40167ea0e1c2-CM788df74daaa0.cpe.net.cable.rogers.com. [99.228.216.21]) by smtp.gmail.com with ESMTPSA id h13sm903421qtu.23.2020.02.19.16.49.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Feb 2020 16:49:42 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Wed, 19 Feb 2020 19:49:37 -0500 Message-Id: <1582159777-2437-1-git-send-email-selva.nair@gmail.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (selva.nair[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.68 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.68 listed in wl.mailspike.net] -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: 1j4a2H-008BH5-B0 Subject: [Openvpn-devel] [PATCH] Fix possibly uninitialized return value in GetOpenvpnSettings() 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Selva Nair Compile time warning for openvpnserv.exe common.c:90:11: warning: ‘error’ may be used uninitialized in this function [-Wmaybe-uninitialized]; Uninitialized value gets returned if install-path is not found in the registry. Fix by setting it to the return value of GetRegString(). Signed-off-by: Selva Nair Acked-by: Lev Stipakov --- Behaviour change: previously, on not finding the install_path in registry, the service logged an error and often continued as the uninitialized value of error could be zero. With this change it will consistently exit with error. src/openvpnserv/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c index fd51776..958643d 100644 --- a/src/openvpnserv/common.c +++ b/src/openvpnserv/common.c @@ -118,8 +118,10 @@ GetOpenvpnSettings(settings_t *s) } /* The default value of REG_KEY is the install path */ - if (GetRegString(key, NULL, install_path, sizeof(install_path), NULL) != ERROR_SUCCESS) + status = GetRegString(key, NULL, install_path, sizeof(install_path), NULL); + if (status != ERROR_SUCCESS) { + error = status; goto out; }