Browse code

Pass correct buffer size to GetModuleFileNameW()

Fixes finding 5.6 of OSTIF/Quarkslab audit

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1494552754-30060-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14647.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Selva Nair authored on 2017/05/12 10:32:34
Showing 1 changed files
... ...
@@ -1334,8 +1334,8 @@ win_wfp_block_dns(const NET_IFINDEX index, const HANDLE msg_channel)
1334 1334
         goto out;
1335 1335
     }
1336 1336
 
1337
-    status = GetModuleFileNameW(NULL, openvpnpath, sizeof(openvpnpath));
1338
-    if (status == 0 || status == sizeof(openvpnpath))
1337
+    status = GetModuleFileNameW(NULL, openvpnpath, _countof(openvpnpath));
1338
+    if (status == 0 || status == _countof(openvpnpath))
1339 1339
     {
1340 1340
         msg(M_WARN|M_ERRNO, "block_dns: cannot get executable path");
1341 1341
         goto out;