From 28c135b8e17385db724ea83a4341fa69178b15b2 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 24 Jul 2020 08:10:00 +0200 Subject: api: tighten maximum registry key path length Maximum registry key path length is not 260 (MAX_PATH), but 255 (256 incl. zero terminator). Signed-off-by: Simon Rozman --- api/registry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'api/registry.c') diff --git a/api/registry.c b/api/registry.c index 157527c..7a68e58 100644 --- a/api/registry.c +++ b/api/registry.c @@ -66,18 +66,18 @@ OpenKeyWait(_In_ HKEY Key, _Inout_z_ WCHAR *Path, _In_ DWORD Access, _In_ ULONGL WINTUN_STATUS RegistryOpenKeyWait( _In_ HKEY Key, - _In_z_count_c_(MAX_PATH) const WCHAR *Path, + _In_z_count_c_(MAX_REG_PATH) const WCHAR *Path, _In_ DWORD Access, _In_ DWORD Timeout, _Out_ HKEY *KeyOut) { - WCHAR Buf[MAX_PATH]; + WCHAR Buf[MAX_REG_PATH]; wcscpy_s(Buf, _countof(Buf), Path); return OpenKeyWait(Key, Buf, Access, GetTickCount64() + Timeout, KeyOut); } WINTUN_STATUS -RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_PATH) const WCHAR *Path, _In_ DWORD Timeout) +RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_REG_PATH) const WCHAR *Path, _In_ DWORD Timeout) { HKEY k; DWORD Result = RegistryOpenKeyWait(Key, Path, KEY_NOTIFY, Timeout, &k); -- cgit v1.2.3-59-g8ed1b