]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix possibly uninitialized return value in GetOpenvpnSettings()
authorSelva Nair <selva.nair@gmail.com>
Thu, 20 Feb 2020 00:49:37 +0000 (19:49 -0500)
committerGert Doering <gert@greenie.muc.de>
Wed, 15 Apr 2020 17:40:45 +0000 (19:40 +0200)
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 <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <1582159777-2437-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19479.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit e1f7d7885752ac3a0279ecc7e31ccee2af40fbe4)

src/openvpnserv/common.c

index 73c418f5822b4e4312b45cff27d5182a885d79a8..eb718d40e0819219f4252b91fc0173f15f4499fd 100644 (file)
@@ -102,8 +102,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;
     }