win: fix buffer size in uv__getpwuid_r()

PR-URL: https://github.com/libuv/libuv/pull/1467
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
This commit is contained in:
tux.uudiin 2017-08-08 11:20:47 +08:00 committed by cjihrig
parent 0b41b0ad39
commit 832ab902cf
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -1388,7 +1388,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token) == 0)
return uv_translate_sys_error(GetLastError());
bufsize = sizeof(path);
bufsize = ARRAY_SIZE(path);
if (!GetUserProfileDirectoryW(token, path, &bufsize)) {
r = GetLastError();
CloseHandle(token);
@ -1403,7 +1403,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
CloseHandle(token);
/* Get the username using GetUserNameW() */
bufsize = sizeof(username);
bufsize = ARRAY_SIZE(username);
if (!GetUserNameW(username, &bufsize)) {
r = GetLastError();