Skip to content

Commit

Permalink
checkpolicy: return YYerror on invalid character
Browse files Browse the repository at this point in the history
Inform bison about an invalid character by returning YYerror, so the
parser can cleanup internal state and return the failure via yyparse().
Currently the error is only observable via the global variable
policydb_errors, which needs to be checked separately.

Reported-by: oss-fuzz (issue #67270)
Signed-off-by: Christian Göttsche <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed Mar 20, 2024
1 parent 0e1e30d commit f4330d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion checkpolicy/policy_scan.l
Expand Up @@ -308,7 +308,7 @@ GLBLUB { return(GLBLUB); }
"]" |
"~" |
"*" { return(yytext[0]); }
. { yyerror("unrecognized character");}
. { yyerror("unrecognized character"); return YYerror; }
%%
int yyerror(const char *msg)
{
Expand Down

0 comments on commit f4330d5

Please sign in to comment.