Commit 2b76b324 authored by Andrei Vagin's avatar Andrei Vagin Committed by Andrei Vagin

restore: avoid an unterminated string

>>>     CID 164715:    (BUFFER_SIZE_WARNING)
>>>     Calling strncpy with a maximum size argument of 16 bytes on
	destination array "thread_args[i].comm" of size 16 bytes might
	leave the destination string unterminated.
3473    strncpy(thread_args[i].comm, core->tc->comm, TASK_COMM_LEN);
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent d40c702d
...@@ -3462,9 +3462,10 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns ...@@ -3462,9 +3462,10 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
goto err; goto err;
if (tcore->thread_core->comm) if (tcore->thread_core->comm)
strncpy(thread_args[i].comm, tcore->thread_core->comm, TASK_COMM_LEN); strncpy(thread_args[i].comm, tcore->thread_core->comm, TASK_COMM_LEN - 1);
else else
strncpy(thread_args[i].comm, core->tc->comm, TASK_COMM_LEN); strncpy(thread_args[i].comm, core->tc->comm, TASK_COMM_LEN - 1);
thread_args[i].comm[TASK_COMM_LEN - 1] = 0;
if (thread_args[i].pid != pid) if (thread_args[i].pid != pid)
core_entry__free_unpacked(tcore, NULL); core_entry__free_unpacked(tcore, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment