]> 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)
committerDavid Sommerseth <davids@openvpn.net>
Thu, 20 Feb 2020 17:48:54 +0000 (18:48 +0100)
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>
src/openvpnserv/common.c

index fd517763b9d5d1b52f4c38782d4c7ab983b7616b..958643dfd0e8a065702a8a3a7498665a10ceab08 100644 (file)
@@ -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;
     }