From: Heiko Hund <[email protected]>

get_openvpn_reg_value() expects the size of the value buffer in bytes,
as documented and as RegGetValueW() expects it. All callers passed the
number of characters instead, so only half of the buffer was used.

Pass sizeof() of the buffers instead of _countof().

Change-Id: Ifa4497963989c2d6ba68d75942d368c112ac6f67
Signed-off-by: Heiko Hund <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2038
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2038
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>

        
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index fde6412..3af58ed 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -1491,7 +1491,7 @@
 set_openssl_env_vars(void)
 {
     WCHAR install_path[MAX_PATH] = { 0 };
-    if (!get_openvpn_reg_value(NULL, install_path, _countof(install_path)))
+    if (!get_openvpn_reg_value(NULL, install_path, sizeof(install_path)))
     {
         const WCHAR *ssl_fallback_dir = L"C:\\Windows\\System32";
         /* if we cannot find installation path from the registry,
@@ -1585,8 +1585,8 @@
 
     /* Attempt to retrieve the trusted plugin directory path from the registry,
      * using installation path as a fallback */
-    if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, _countof(plugin_dir))
-        && !get_openvpn_reg_value(NULL, plugin_dir, _countof(plugin_dir)))
+    if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, sizeof(plugin_dir))
+        && !get_openvpn_reg_value(NULL, plugin_dir, sizeof(plugin_dir)))
     {
         msg(M_WARN, "Installation path could not be determined.");
     }


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to