From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Beat Bolli <dev+git@drbeat.li>,
Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/1] mingw: fix possible buffer overrun when calling `GetUserNameW()`
Date: Thu, 04 Jul 2019 15:36:57 -0700 (PDT) [thread overview]
Message-ID: <15bd816ea576554beefe5b1d495e0ec2810a7d5b.1562279815.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.283.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
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>
---
compat/mingw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
gitgitgadget
prev parent reply other threads:[~2019-07-04 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 22:36 [PATCH 0/1] Follow-up on top of js/mingw-use-utf8 Johannes Schindelin via GitGitGadget
2019-07-04 22:36 ` Johannes Schindelin via GitGitGadget [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15bd816ea576554beefe5b1d495e0ec2810a7d5b.1562279815.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=dev+git@drbeat.li \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).