mingw: fix possible buffer overrun when calling `GetUserNameW()`

In 39a98e9b68b8 (mingw: get pw_name in UTF-8 format, 2019-06-27), this developer missed the fact that the `GetUserNameW()` function takes the number of characters as `len` parameter, not the number of bytes. Reported-by: Beat Bolli <dev+git@drbeat.li> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 4, 2019 at 15:36 UTC 697bdd22b887a0778489814e44dcec850aa82ad0
1 file changed +1 -1
compat/mingw.c
+1 -1
@@ -1952,7 +1952,7 @@ struct passwd *getpwuid(int uid)
1952 if (initialized)
1953 return p;
1954
1955 - len = sizeof(buf);
1955 + len = ARRAY_SIZE(buf);
1956 if (!GetUserNameW(buf, &len)) {
1957 initialized = 1;
1958 return NULL;