summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ac4838)
raw | patch | inline | side by side (parent: 8ac4838)
author | Pavel Roskin <proski@gnu.org> | |
Wed, 21 Dec 2005 23:47:09 +0000 (18:47 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 22 Dec 2005 01:05:09 +0000 (17:05 -0800) |
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
access uninitialized memory for packs with short names.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index fa22e9c71a0360ad5c3a865e0d6b3b49ba97e064..d83d8240d001997acf715a67cd60621d48b51e34 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
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;
}