Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 19, 2016, 16:59 UTC
- Message-ID
- <alpine.DEB.2.20.1612191758290.54750@virtualbox>
- In-Reply-To
- <20161215185630.xxeimack63wqwv2e@sigill.intra.peff.net>
Hi Peff,
On Thu, 15 Dec 2016, Jeff King wrote:
Show 12 quoted lines
> On Thu, Dec 15, 2016 at 10:42:53AM -0800, Junio C Hamano wrote:
>
> > > + sprintf((char *)p, "%d", ++count);
> >
> > Do we know the area pointed at p (which is inside buf) long enough
> > not to overflow? If the original were 9 and you incremented to get
> > 10, you would need one extra byte.
>
> Even if it is enough, I'd ask to please use xsnprintf(). In the off
> chance that there's a programming error, we'd get a nice die("BUG")
> instead of a buffer overflow (and it makes the code base easier to audit
> for other overflows).I ended up with more verbose, easier-to-read code that does not try to do things in-place, in favor of being slightly more wasteful with strbufs.
Ciao, Dscho