Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:06:34

Ramsay Jones [off-list ref] writes:
How about using strlcpy() instead? Thus:

-	strcpy(header.name, "pax_global_header");
+	strlcpy(header.name, "pax_global_header", sizeof(header.name));

Ditto for other similar (strcpy->xsnprintf) hunks below.
Please do not advocate use of strlcpy(), which substitutes
overwriting beyond the end of the buffer (which is a bug) with a
silent truncation (which is almost always another bug, unless in a
very narrow case of producing a non-essential string result where
loss of information does not matter).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help