Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: fix cbpf parser bug for octal numbers

Range is 0-7, not 0-9, otherwise parser silently excludes it from the
strtol() rather than throwing an error.

Reported-by: Marc Boschma <marc@boschma.cx>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Daniel Borkmann and committed by
Alexei Starovoitov
b3bbba35 1fbc2e0c

+1 -1
+1 -1
tools/bpf/bpf_exp.l
··· 175 175 yylval.number = strtol(yytext, NULL, 10); 176 176 return number; 177 177 } 178 - ([0][0-9]+) { 178 + ([0][0-7]+) { 179 179 yylval.number = strtol(yytext + 1, NULL, 8); 180 180 return number; 181 181 }