From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Eric Roman <eroman@chromium.org>,
git@vger.kernel.org
Subject: Re: [PATCH] show-branch: use strbuf instead of static buffer
Date: Fri, 5 Apr 2013 16:49:15 -0700 [thread overview]
Message-ID: <20130405234915.GU30308@google.com> (raw)
In-Reply-To: <20130405211550.GA4880@sigill.intra.peff.net>
Jeff King wrote:
> When we generate relative names (e.g., "master~20^2"), we
> format the name into a static buffer, then xstrdup the
> result to attach it to the commit. Since the first thing we
> add into the static buffer is the already-computed name of
> the child commit, the names may get longer and longer as
> the traversal gets deeper, and we may eventually overflow
> the fixed-size buffer.
Good catch.
[...]
> Though this is a stack overflow, I don't know that it's exploitable for
> anything interesting; an attacker does not get to write arbitrary data,
> but rather only a sequence of "^%d" and "~%d" relative history markers.
> Perhaps in theory one could devise a history such that the sequence
> markers spelled out some malicious code, but it would be quite a
> challenge
Overwrite the return address and return-to-libc?
[...]
> --- a/builtin/show-branch.c
> +++ b/builtin/show-branch.c
Very clean and obviously correct. Thanks.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
A test would be nice, though.
Hope that helps,
Jonathan
next prev parent reply other threads:[~2013-04-06 16:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-05 21:15 [PATCH] show-branch: use strbuf instead of static buffer Jeff King
2013-04-05 23:49 ` Jonathan Nieder [this message]
2013-04-06 4:58 ` Jeff King
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=20130405234915.GU30308@google.com \
--to=jrnieder@gmail.com \
--cc=eroman@chromium.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).