From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] Don't allocate too much memory in quote_ref_url
Date: Sat, 14 Jun 2008 12:02:22 +0200 [thread overview]
Message-ID: <1213437742-5751-1-git-send-email-mh@glandium.org> (raw)
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.
---
I noticed this when rebasing some of my private branches onto current
master. I had a commit similar to c13b263 that ended up conflicting,
and after conflict resolving, this is all that was left, which is
an obvious change that was lacking there.
http.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/http.c b/http.c
index bc14bdb..9b6d5ed 100644
--- a/http.c
+++ b/http.c
@@ -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;
for (cp = ref; (ch = *cp) != 0; cp++, len++)
if (needs_quote(ch))
len += 2; /* extra two hex plus replacement % */
--
1.5.5.4
reply other threads:[~2008-06-14 10:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1213437742-5751-1-git-send-email-mh@glandium.org \
--to=mh@glandium.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).