Skip to content

Commit

Permalink
Merge branch 'rs/fix-alt-odb-path-comparison' into maint
Browse files Browse the repository at this point in the history
Code to avoid adding the same alternate object store twice was
subtly broken for a long time, but nobody seems to have noticed.

* rs/fix-alt-odb-path-comparison:
  sha1_file: avoid overrunning alternate object base string
  • Loading branch information
Junio C Hamano committed Jul 16, 2014
2 parents 5c18fde + 80b4785 commit 5a3db94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5a3db94

Please sign in to comment.