mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
bpf: ensure all memory is initialized in bpf_get_current_comm
BPF helpers that take an ARG_PTR_TO_UNINIT_MEM must ensure that all of the memory is set, including beyond the end of the string. Signed-off-by: Barret Rhoden <brho@google.com> Link: https://lore.kernel.org/r/20230407001808.1622968-1-brho@google.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
4daf0b327f
commit
f3f2134977
@ -258,7 +258,7 @@ BPF_CALL_2(bpf_get_current_comm, char *, buf, u32, size)
|
||||
goto err_clear;
|
||||
|
||||
/* Verifier guarantees that size > 0 */
|
||||
strscpy(buf, task->comm, size);
|
||||
strscpy_pad(buf, task->comm, size);
|
||||
return 0;
|
||||
err_clear:
|
||||
memset(buf, 0, size);
|
||||
|
Loading…
Reference in New Issue
Block a user