From: Elia Pinto Date: Fri, 03 Jun 2016 07:47:23 GMT Subject: [PATCH 09/10] transport-helper.c: convert trivial snprintf calls to xsnprintf Message-ID: <20160603074724.12173-9-gitter.spiros@gmail.com> In-Reply-To: <20160603074724.12173-1-gitter.spiros@gmail.com> 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 --- transport-helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/transport-helper.c b/transport-helper.c index bd666b2..18e9f44 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -317,9 +317,7 @@ static void standard_options(struct transport *t) set_helper_option(t, "progress", t->progress ? "true" : "false"); - n = snprintf(buf, sizeof(buf), "%d", v + 1); - if (n >= sizeof(buf)) - die("impossibly large verbosity value"); + n = xsnprintf(buf, sizeof(buf), "%d", v + 1); set_helper_option(t, "verbosity", buf); switch (t->family) { -- 2.9.0.rc1.265.geb5d750