Also replace MAX_PATH by _countof(openvpnpath) as the latter
is arguably more robust.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <
1494800196-8144-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14654.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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;