Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-07-05 01:36:57 +0300
committerJunio C Hamano <gitster@pobox.com>2019-07-08 22:09:12 +0300
commit697bdd22b887a0778489814e44dcec850aa82ad0 (patch)
treed8799bdc7f1534fbb342c35edf834e6301a9f3bf /compat
parent94238859b9809afc806919cb7022a45cdc8e6748 (diff)
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>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index b8a62bf914..a0eb695653 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1952,7 +1952,7 @@ struct passwd *getpwuid(int uid)
if (initialized)
return p;
- len = sizeof(buf);
+ len = ARRAY_SIZE(buf);
if (!GetUserNameW(buf, &len)) {
initialized = 1;
return NULL;