Browse Source

Merge branch 'rs/fix-alt-odb-path-comparison' into maint

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
maint
Junio C Hamano 11 years ago
parent
commit
5a3db94539
  1. 3
      sha1_file.c

3
sha1_file.c

@ -315,7 +315,8 @@ static int link_alt_odb_entry(const char *entry, const char *relative_base, int @@ -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;
}

Loading…
Cancel
Save