summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-02-16 14:33:22 -0800
committerJunio C Hamano <gitster@pobox.com>2011-02-16 14:33:22 -0800
commit5673d695fcce217b26d1a5956c1184ff62dc74f1 (patch)
tree1985086e66f084e2e789f8c5b5950fc18b5ba3b4
parent43f9f053010c119c9836b2b5f8a07c72784f79b6 (diff)
parent759e84f07fd0fba2f3466b11b74146173d42cb6b (diff)
downloadgit-5673d695fcce217b26d1a5956c1184ff62dc74f1.tar.gz
Merge branch 'maint'
* maint: parse_tag_buffer(): do not prefixcmp() out of range
-rw-r--r--tag.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tag.c b/tag.c
index ecf7c1e9ce..7d38cc0f4d 100644
--- a/tag.c
+++ b/tag.c
@@ -97,7 +97,9 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
item->tagged = NULL;
}
- if (prefixcmp(bufptr, "tag "))
+ if (bufptr + 4 < tail && !prefixcmp(bufptr, "tag "))
+ ; /* good */
+ else
return -1;
bufptr += 4;
nl = memchr(bufptr, '\n', tail - bufptr);
@@ -106,7 +108,7 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
item->tag = xmemdupz(bufptr, nl - bufptr);
bufptr = nl + 1;
- if (!prefixcmp(bufptr, "tagger "))
+ if (bufptr + 7 < tail && !prefixcmp(bufptr, "tagger "))
item->date = parse_tag_date(bufptr, tail);
else
item->date = 0;