summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-10 18:27:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-10 18:27:52 (GMT)
commitb41a4636eea8961e88f107818a68513f847b6fd3 (patch)
treec4d41dd1e67a14698313e7cb1337a7c4568c10e9 /sha1_file.c
parente7cdec622afeae0869140e72a1c45392e672465e (diff)
parent80b47854ca84abec991f6fff42dbeb6626588b87 (diff)
downloadgit-b41a4636eea8961e88f107818a68513f847b6fd3.zip
git-b41a4636eea8961e88f107818a68513f847b6fd3.tar.gz
git-b41a4636eea8961e88f107818a68513f847b6fd3.tar.bz2
Merge branch 'rs/fix-alt-odb-path-comparison'
* rs/fix-alt-odb-path-comparison: sha1_file: avoid overrunning alternate object base string
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 34d527f..a38854c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -315,7 +315,8 @@ static int link_alt_odb_entry(const char *entry, const char *relative_base, int
* thing twice, or object directory itself.
*/
for (alt = alt_odb_list; alt; alt = alt->next) {
- if (!memcmp(ent->base, alt->base, pfxlen)) {
+ if (pfxlen == alt->name - alt->base - 1 &&
+ !memcmp(ent->base, alt->base, pfxlen)) {
free(ent);
return -1;
}