Skip to content

Commit

Permalink
Fix a parsing bug in the rules that would ignore the very first rule.…
Browse files Browse the repository at this point in the history
… See #23.
  • Loading branch information
samhocevar committed Mar 2, 2021
1 parent af88e6f commit d4e0a60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ YY_ACTION(void) yy_1_auth_rule(yycontext *yy, char *yytext, int yyleng)
}
allRules[allRulesCount].type = yy->isAuthAllow ? allowRule : denyRule;
if (seTotal > 0) {
if (seInfo[seTotal - 1].rulesStart == 0) {
if (seInfo[seTotal - 1].rulesStart == 0 && seInfo[seTotal - 1].rulesCount == 0) {
seInfo[seTotal - 1].rulesStart = allRulesCount;
}
++seInfo[seTotal - 1].rulesCount;
Expand Down
2 changes: 1 addition & 1 deletion src/parse.peg
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ auth-rule = auth-key - < pattern >
}
allRules[allRulesCount].type = yy->isAuthAllow ? allowRule : denyRule;
if (seTotal > 0) {
if (seInfo[seTotal - 1].rulesStart == 0) {
if (seInfo[seTotal - 1].rulesStart == 0 && seInfo[seTotal - 1].rulesCount == 0) {
seInfo[seTotal - 1].rulesStart = allRulesCount;
}
++seInfo[seTotal - 1].rulesCount;
Expand Down

0 comments on commit d4e0a60

Please sign in to comment.