Replaced strncpy() with g_strlcpy() in helper-procfs.c 37/225137/1 accepted/tizen/unified/20200227.121053 submit/tizen/20200220.041614 submit/tizen/20200227.012332
authorJaehyun Kim <jeik01.kim@samsung.com>
Mon, 17 Feb 2020 12:52:00 +0000 (21:52 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Mon, 17 Feb 2020 12:54:06 +0000 (21:54 +0900)
strncpy doesn’t set zero byte implicitly.

Change-Id: I45f322916017d2b727902e713284d0e8ffa19fad
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/helper/helper-procfs.c

index 60e5db2..a0d9f0e 100644 (file)
@@ -259,7 +259,7 @@ API int proc_get_status(pid_t pid, char status[][PROC_BUF_MAX])
                        if (token != NULL) {
                                while (isspace((unsigned char)*token))
                                        token++;
                        if (token != NULL) {
                                while (isspace((unsigned char)*token))
                                        token++;
-                               strncpy(status[index], token,
+                               g_strlcpy(status[index], token,
                                        sizeof(status[index]));
                                updated[index] = TRUE;
                        }
                                        sizeof(status[index]));
                                updated[index] = TRUE;
                        }