From: Selva Nair Date: Thu, 20 Feb 2020 00:49:37 +0000 (-0500) Subject: Fix possibly uninitialized return value in GetOpenvpnSettings() X-Git-Tag: v2.4.9~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d9e0be2a7733b0efb0556d187a36912606a9d97;p=thirdparty%2Fopenvpn.git 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 Acked-by: Lev Stipakov 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 (cherry picked from commit e1f7d7885752ac3a0279ecc7e31ccee2af40fbe4) --- diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c index 73c418f58..eb718d40e 100644 --- a/src/openvpnserv/common.c +++ b/src/openvpnserv/common.c @@ -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; }