http-fetch.c: fix objects/info/pack parsing.
It failed to register the last pack in the objects/info/packs file. Also it had an independent overrun error. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 21, 2005 at 12:10 UTC
455c161c47542de7e67d2ba48bba637e5a645388
1 file changed
+2
-2
http-fetch.c
+2
-2
@@ -658,7 +658,7 @@ static int fetch_indices(struct alt_base *repo)
658
switch (data[i]) {
659
case 'P':
660
i++;
661
- if (i + 52 < buffer.posn &&
661
+ if (i + 52 <= buffer.posn &&
662
!strncmp(data + i, " pack-", 6) &&
663
!strncmp(data + i + 46, ".pack\n", 6)) {
664
get_sha1_hex(data + i + 6, sha1);
@@ -667,7 +667,7 @@ static int fetch_indices(struct alt_base *repo)
667
break;
668
}
669
default:
670
- while (data[i] != '\n')
670
+ while (i < buffer.posn && data[i] != '\n')
671
i++;
672
}
673
i++;