Skip to content

Commit c8eb8b8

Browse files
ea1davisKernel Patches Daemon
authored andcommitted
bpf: fix oob in btf_name_valid_section
Check the first char of the BTF DATASEC names. Fixes: bd70a8f ("bpf: Allow all printable characters in BTF DATASEC names") Reported-and-tested-by: syzbot+cc32304f6487ebff9b70@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis <eadavis@qq.com>
1 parent 6b2a4d7 commit c8eb8b8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/btf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ static bool btf_name_valid_section(const struct btf *btf, u32 offset)
816816
const char *src = btf_str_by_offset(btf, offset);
817817
const char *src_limit;
818818

819+
if (!isprint(*src))
820+
return false;
819821
/* set a limit on identifier length */
820822
src_limit = src + KSYM_NAME_LEN;
821823
src++;

0 commit comments

Comments
 (0)