From: Selva Nair <selva.n...@gmail.com>

Also replace MAX_PATH by _countof(openvpnpath) as the latter
is arguably more robust.

Signed-off-by: Selva Nair <selva.n...@gmail.com>
---
 src/openvpn/win32.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index b271597..56c3a1d 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -1271,7 +1271,12 @@ win_wfp_block_dns (const NET_IFINDEX index)
     dmsg (D_LOW, "Tap Luid: %I64d", tapluid.Value);
 
     /* Get OpenVPN path. */
-    GetModuleFileNameW(NULL, openvpnpath, MAX_PATH);
+    status = GetModuleFileNameW(NULL, openvpnpath, _countof(openvpnpath));
+    if (status == 0 || status == _countof(openvpnpath))
+    {
+        msg(M_WARN|M_ERRNO, "block_dns: failed to get executable path");
+        goto err;
+    }
 
     if (FwpmGetAppIdFromFileName0(openvpnpath, &openvpnblob) != ERROR_SUCCESS)
         goto err;
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to