From aad1d3319e65c758f19d783f0966946cd7b057dc Mon Sep 17 00:00:00 2001 From: Konrad Kuchciak Date: Mon, 30 Dec 2019 13:23:53 +0100 Subject: [PATCH] Fix SVACE issue Use snprintf instead of sprintf Change-Id: I33d5f75f49346e25db29ce8b3e3d7bc6e911d33b --- src/action.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/action.c b/src/action.c index f5b2a02..6fe9167 100644 --- a/src/action.c +++ b/src/action.c @@ -136,17 +136,18 @@ static void livedump_pid_thread_cb(GTask *task, char *actual_str = g_variant_print(ad->actual_value, TRUE); char *allowed_str = g_variant_print(ad->allowed_value, TRUE); - ret = sprintf(reason, "Stability-monitor detected abnormality.\n" - "Process name: %s\n" - "PID: %d\n" - "Exceeded parameter: %s\n" - "Actual value: %s\n" - "Allowed value: %s\n", - ad->ds->process->name, - ad->ds->process->pid, - ad->ds->param_name, - actual_str, - allowed_str); + ret = snprintf(reason, sizeof(reason), + "Stability-monitor detected abnormality.\n" + "Process name: %s\n" + "PID: %d\n" + "Exceeded parameter: %s\n" + "Actual value: %s\n" + "Allowed value: %s\n", + ad->ds->process->name, + ad->ds->process->pid, + ad->ds->param_name, + actual_str, + allowed_str); if (ret == -1) { _E("Couldn't print dbus object path: %m"); goto finish; -- 2.34.1