summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Słodczyk <m.slodczyk2@partner.samsung.com>2020-05-27 13:00:25 +0200
committerMaciej Słodczyk <m.slodczyk2@partner.samsung.com>2020-06-01 13:30:05 +0200
commitefc76d963073c094d7f5ab0f6a86f5a40b6a14da (patch)
tree005297a2d454004aae365cc7ad7814222e179773
parent7bcccb7b32f562f61e08fafe9675804c1811ede4 (diff)
downloadresourced-headless-accepted/tizen_6.0_unified.tar.gz
resourced-headless-accepted/tizen_6.0_unified.tar.bz2
resourced-headless-accepted/tizen_6.0_unified.zip
Deliberately copying substring with strncpy() resulted in 'output may be truncated' warning. Use memcpy() to achieve the same without the warning. Change-Id: I8759159e9dd823e78001d4812c52cf2e8588c4e0 Signed-off-by: Maciej Słodczyk <m.slodczyk2@partner.samsung.com>
-rw-r--r--src/common/procfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/procfs.c b/src/common/procfs.c
index 12698cb..b59ed93 100644
--- a/src/common/procfs.c
+++ b/src/common/procfs.c
@@ -460,7 +460,7 @@ API int procfs_get_pid_stat(pid_t pid, struct procfs_pid_stat *pps)
{
FILE *fp = NULL;
char buf[BUF_SIZE];
- char comm[BUF_SIZE];
+ char comm[BUF_SIZE] = {};
if (pid < 1 || !pps) {
_E("Invalid parameter");
@@ -484,7 +484,7 @@ API int procfs_get_pid_stat(pid_t pid, struct procfs_pid_stat *pps)
fclose(fp);
return -ENOENT;
}
- strncpy(pps->comm, comm, COMM_SIZE - 1);
+ memcpy(pps->comm, comm, COMM_SIZE - 1);
pps->comm[COMM_SIZE - 1] = '\0';
fclose(fp);