Thread (104 messages) flat view 104 messages, 5 authors, 2016-06-15

Re: [PATCH 15/67] convert trivial sprintf / strcpy calls to xsnprintf

From: Jeff King <hidden>
Date: 2016-06-15 23:06:34

On Tue, Sep 15, 2015 at 11:19:21PM -0400, Eric Sunshine wrote:
quoted
                strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
-               sprintf(ownbuf[stage], "%o", ce->ce_mode);
+               xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
Interesting. I wonder if there are any (old/broken) compilers which
would barf on this. If we care, perhaps sizeof(ownbuf[0]) instead?
Good point. I've changed it to sizeof(ownbuf[0]).

-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