From 9092397ce02616b06c5c748de0b45775c7aa1e73 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Thu, 11 May 2017 21:32:34 -0400 Subject: [PATCH] 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) --- src/openvpn/win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.47.2