bpf: fix cbpf parser bug for octal numbers
authorDaniel Borkmann <[email protected]>
Sat, 2 Jun 2018 21:06:38 +0000 (23:06 +0200)
committerAlexei Starovoitov <[email protected]>
Sun, 3 Jun 2018 14:46:55 +0000 (07:46 -0700)
Range is 0-7, not 0-9, otherwise parser silently excludes it from the
strtol() rather than throwing an error.

Reported-by: Marc Boschma <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Acked-by: Song Liu <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
tools/bpf/bpf_exp.l

index bd83149e7be04c3968f9e60d730aca4b1c40b331..4da8d053d68f58d1be2ba277aec3439a611bf110 100644 (file)
@@ -175,7 +175,7 @@ extern void yyerror(const char *str);
                        yylval.number = strtol(yytext, NULL, 10);
                        return number;
                }
-([0][0-9]+)    {
+([0][0-7]+)    {
                        yylval.number = strtol(yytext + 1, NULL, 8);
                        return number;
                }