Fix SVACE issue 54/221254/2
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Mon, 30 Dec 2019 12:23:53 +0000 (13:23 +0100)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Mon, 30 Dec 2019 12:26:41 +0000 (13:26 +0100)
Use snprintf instead of sprintf

Change-Id: I33d5f75f49346e25db29ce8b3e3d7bc6e911d33b

src/action.c

index f5b2a02..6fe9167 100644 (file)
@@ -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;