Skip to content

Commit

Permalink
Don't allocate too much memory in quote_ref_url
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Hommey authored and Junio C Hamano committed Jun 14, 2008
1 parent 66115d3 commit 7c1a9e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ static char *quote_ref_url(const char *base, const char *ref)
int len, baselen, ch;

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

0 comments on commit 7c1a9e7

Please sign in to comment.