{"thread":{"id":"13949","subject":"[PATCH] Don't allocate too much memory in quote_ref_url","startedAt":"2008-06-14T10:02:22Z","lastAt":"2008-06-14T10:02:22Z","messageCount":1,"participants":["Mike Hommey"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"79845","messageId":"1213437742-5751-1-git-send-email-mh@glandium.org","threadId":"13949","inReplyTo":null,"subject":"[PATCH] Don't allocate too much memory in quote_ref_url","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-06-14T10:02:22Z","receivedAt":"2008-06-14T10:02:22Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"In c13b263, http_fetch_ref got \"refs/\" included in the ref passed to it,\nwhich, incidentally, makes the allocation in quote_ref_url too big, now.\n---\n\nI noticed this when rebasing some of my private branches onto current\nmaster. I had a commit similar to c13b263 that ended up conflicting,\nand after conflict resolving, this is all that was left, which is\nan obvious change that was lacking there.\n\n http.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex bc14bdb..9b6d5ed 100644\n--- a/http.c\n+++ b/http.c\n@@ -583,7 +583,7 @@ static char *quote_ref_url(const char *base, const char *ref)\n \tint len, baselen, ch;\n \n \tbaselen = strlen(base);\n-\tlen = baselen + 7; /* \"/refs/\" + NUL */\n+\tlen = baselen + 2;\n \tfor (cp = ref; (ch = *cp) != 0; cp++, len++)\n \t\tif (needs_quote(ch))\n \t\t\tlen += 2; /* extra two hex plus replacement % */\n-- \n1.5.5.4\n"}]}