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>
{
FILE *fp = NULL;
char buf[BUF_SIZE];
- char comm[BUF_SIZE];
+ char comm[BUF_SIZE] = {};
if (pid < 1 || !pps) {
_E("Invalid parameter");
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);