Skip to content

Commit 7c1a9e7

Browse files
glandiumgitster
authored andcommitted
Don't allocate too much memory in quote_ref_url
In c13b263, http_fetch_ref got "refs/" included in the ref passed to it, which, incidentally, makes the allocation in quote_ref_url too big, now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 66115d3 commit 7c1a9e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static char *quote_ref_url(const char *base, const char *ref)
583583
int len, baselen, ch;
584584

585585
baselen = strlen(base);
586-
len = baselen + 7; /* "/refs/" + NUL */
586+
len = baselen + 2; /* '/' after base and terminating NUL */
587587
for (cp = ref; (ch = *cp) != 0; cp++, len++)
588588
if (needs_quote(ch))
589589
len += 2; /* extra two hex plus replacement % */

0 commit comments

Comments
 (0)