From: Pavel Roskin <proski@gnu.org>
To: git <git@vger.kernel.org>
Subject: [PATCH] sanity check in add_packed_git()
Date: Wed, 21 Dec 2005 18:47:09 -0500 [thread overview]
Message-ID: <1135208829.15567.18.camel@dv> (raw)
add_packed_git() tries to get the pack SHA1 by parsing its name. It may
access uninitialized memory for packs with short names.
Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/sha1_file.c b/sha1_file.c
index fa22e9c..d83d824 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -464,7 +464,7 @@ struct packed_git *add_packed_git(char *
p->pack_last_used = 0;
p->pack_use_cnt = 0;
p->pack_local = local;
- if (!get_sha1_hex(path + path_len - 40 - 4, sha1))
+ if ((path_len > 44) && !get_sha1_hex(path + path_len - 44, sha1))
memcpy(p->sha1, sha1, 20);
return p;
}
--
Regards,
Pavel Roskin
next reply other threads:[~2005-12-21 23:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-21 23:47 Pavel Roskin [this message]
2005-12-22 1:42 ` [PATCH] sanity check in add_packed_git() Junio C Hamano
2005-12-22 1:58 ` Daniel Barkalow
2005-12-22 9:39 ` Junio C Hamano
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=1135208829.15567.18.camel@dv \
--to=proski@gnu.org \
--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 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).