Browse code

Fix possibly uninitialized return value in GetOpenvpnSettings()

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)

Selva Nair authored on 2020/02/20 09:49:37
Showing 1 changed files
... ...
@@ -102,8 +102,10 @@ GetOpenvpnSettings(settings_t *s)
102 102
     }
103 103
 
104 104
     /* The default value of REG_KEY is the install path */
105
-    if (GetRegString(key, NULL, install_path, sizeof(install_path), NULL) != ERROR_SUCCESS)
105
+    status = GetRegString(key, NULL, install_path, sizeof(install_path), NULL);
106
+    if (status != ERROR_SUCCESS)
106 107
     {
108
+        error = status;
107 109
         goto out;
108 110
     }
109 111