Commit f3f21349 authored by Barret Rhoden's avatar Barret Rhoden Committed by Alexei Starovoitov

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: default avatarBarret Rhoden <brho@google.com>
Link: https://lore.kernel.org/r/20230407001808.1622968-1-brho@google.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 4daf0b32
......@@ -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);
......
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