Thread (5 messages) flat view 5 messages, 3 authors, 2016-12-19

Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands

From: Jeff King <hidden>
Date: 2016-12-19 17:20:43

On Mon, Dec 19, 2016 at 05:59:06PM +0100, Johannes Schindelin wrote:
quoted
quoted
quoted
+		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.
Great. I agree that should make the whole thing way more readable.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help