From: Selva Nair Date: Fri, 12 May 2017 01:32:34 +0000 (-0400) Subject: Pass correct buffer size to GetModuleFileNameW() X-Git-Tag: v2.4.3~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9092397ce02616b06c5c748de0b45775c7aa1e73;p=thirdparty%2Fopenvpn.git Pass correct buffer size to GetModuleFileNameW() Fixes finding 5.6 of OSTIF/Quarkslab audit Signed-off-by: Selva Nair Acked-by: Gert Doering 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 (cherry picked from commit 986b930862c7fecb2a42645f1dc23a53ab2cf6bb) --- diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index 0cbf5fde5..9a0368144 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -1334,8 +1334,8 @@ win_wfp_block_dns(const NET_IFINDEX index, const HANDLE msg_channel) goto out; } - status = GetModuleFileNameW(NULL, openvpnpath, sizeof(openvpnpath)); - if (status == 0 || status == sizeof(openvpnpath)) + status = GetModuleFileNameW(NULL, openvpnpath, _countof(openvpnpath)); + if (status == 0 || status == _countof(openvpnpath)) { msg(M_WARN|M_ERRNO, "block_dns: cannot get executable path"); goto out;