From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] win32: ensure len does not cause any overreads
Date: Mon, 19 Dec 2022 17:17:02 +0000 [thread overview]
Message-ID: <pull.1404.git.git.1671470222521.gitgitgadget@gmail.com> (raw)
From: Seija Kijin <doremylover123@gmail.com>
Check to make sure len is always less than MAX_PATH,
otherwise an overread will occur, which is
undefined behavior.
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
win32: ensure len does not cause any overreads
Check to make sure len is always less than MAX_PATH, otherwise an
overread will occur, which is undefined behavior.
Signed-off-by: Seija Kijin doremylover123@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1404%2FAtariDreams%2Foverread-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1404/AtariDreams/overread-v1
Pull-Request: https://github.com/git/git/pull/1404
compat/win32/dirent.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/win32/dirent.c b/compat/win32/dirent.c
index 52420ec7d4d..0c1bdccdd58 100644
--- a/compat/win32/dirent.c
+++ b/compat/win32/dirent.c
@@ -27,7 +27,7 @@ DIR *opendir(const char *name)
DIR *dir;
/* convert name to UTF-16 and check length < MAX_PATH */
- if ((len = xutftowcs_path(pattern, name)) < 0)
+ if ((len = xutftowcs_path(pattern, name)) < 0 || len > MAX_PATH)
return NULL;
/* append optional '/' and wildcard '*' */
base-commit: 7c2ef319c52c4997256f5807564523dfd4acdfc7
--
gitgitgadget
next reply other threads:[~2022-12-19 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 17:17 Rose via GitGitGadget [this message]
2022-12-19 18:19 ` [PATCH] win32: ensure len does not cause any overreads Ævar Arnfjörð Bjarmason
2022-12-19 20:37 ` Phillip Wood
2024-12-18 0:29 ` [PATCH v2] " AreaZR via GitGitGadget
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=pull.1404.git.git.1671470222521.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=83477269+AtariDreams@users.noreply.github.com \
--cc=doremylover123@gmail.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.