2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

proc_pase: Make sure we may scan up to 15 symbols in name

And do not use strcpy, better to stick with strncpy.

Moreover, to be on a safe side make proc internal
buffer big enough even for "(%16s)" format, it's
hardly possible that the kernel ever change stat
format but just to be on a safe side.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Cyrill Gorcunov
2012-01-15 20:24:13 +04:00
parent a9969dcf72
commit f80694deed
3 changed files with 6 additions and 6 deletions

View File

@@ -449,7 +449,7 @@ static int get_task_stat(pid_t pid, int pid_dir, u8 *comm, u32 *flags,
if (ret < 0)
goto err;
strcpy((char *)comm, pps_buf.comm);
strncpy((char *)comm, pps_buf.comm, TASK_COMM_LEN);
*flags = pps_buf.flags;
*start_code = pps_buf.start_code;
*end_code = pps_buf.end_code;