git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/10] builtin/commit.c: convert trivial snprintf calls to xsnprintf
@ 2016-06-03  7:47 Elia Pinto
  2016-06-03  7:47 ` [PATCH 02/10] builtin/index-pack.c: " Elia Pinto
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Elia Pinto @ 2016-06-03  7:47 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

With the commits f2f02675 and 5096d490 we have been converted in some files the call
from snprintf/sprintf/strcpy to xsnprintf. This patch converts the remaining calls
to snprintf with xsnprintf under the following conditions:

- The call to snprintf does not control the outcome of the command
  or the presence of truncation errors.
- A call to snprintf can generate a fatal error, directly or indirectly.

The other few remaining cases in which a call to snprintf can generate a soft error
have not been changed.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 builtin/commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 443ff91..c65abaa 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1552,7 +1552,7 @@ static int run_rewrite_hook(const unsigned char *oldsha1,
 	code = start_command(&proc);
 	if (code)
 		return code;
-	n = snprintf(buf, sizeof(buf), "%s %s\n",
+	n = xsnprintf(buf, sizeof(buf), "%s %s\n",
 		     sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
 	sigchain_push(SIGPIPE, SIG_IGN);
 	write_in_full(proc.in, buf, n);
-- 
2.9.0.rc1.265.geb5d750

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-06-03 17:10 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03  7:47 [PATCH 01/10] builtin/commit.c: convert trivial snprintf calls to xsnprintf Elia Pinto
2016-06-03  7:47 ` [PATCH 02/10] builtin/index-pack.c: " Elia Pinto
2016-06-03  8:53   ` Jeff King
2016-06-03 15:32     ` Ramsay Jones
2016-06-03 17:10       ` Jeff King
2016-06-03  7:47 ` [PATCH 03/10] builtin/tag.c: " Elia Pinto
2016-06-03  8:52   ` Jeff King
2016-06-03 15:37     ` Ramsay Jones
2016-06-03  7:47 ` [PATCH 04/10] combine-diff.c: " Elia Pinto
2016-06-03  8:54   ` Jeff King
2016-06-03  7:47 ` [PATCH 05/10] compat/inet_ntop.c: " Elia Pinto
2016-06-03  7:47 ` [PATCH 06/10] diff.c: " Elia Pinto
2016-06-03  9:03   ` Jeff King
2016-06-03  7:47 ` [PATCH 07/10] fast-import.c: " Elia Pinto
2016-06-03  7:47 ` [PATCH 08/10] refs.c: " Elia Pinto
2016-06-03  7:47 ` [PATCH 09/10] transport-helper.c: " Elia Pinto
2016-06-03  7:47 ` [PATCH 10/10] wrapper.c: " Elia Pinto
2016-06-03  9:13   ` Jeff King
2016-06-03  8:49 ` [PATCH 01/10] builtin/commit.c: " Jeff King
2016-06-03  9:04   ` Jeff King
2016-06-03 15:25   ` Ramsay Jones

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).