Skip to content

Commit

Permalink
libsepol/cil: Limit the number of active line marks
Browse files Browse the repository at this point in the history
A line mark functions like an open parenthesis, so the number of
active line marks should be limited like the number of open
parenthesis.

This issue was found by the secilc-fuzzer.

Signed-off-by: James Carter <[email protected]>
Acked-by: Nicolas Iooss <[email protected]>
  • Loading branch information
jwcart2 authored and bachradsusi committed Sep 8, 2021
1 parent d0b5ba0 commit ff143e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libsepol/cil/src/cil_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ static int add_hll_linemark(struct cil_tree_node **current, uint32_t *hll_offset
*current = (*current)->parent;
} else {
push_hll_info(stack, *hll_offset, *hll_expand);
if (cil_stack_number_of_items(stack) > CIL_PARSER_MAX_EXPR_DEPTH) {
cil_log(CIL_ERR, "Number of active line marks exceeds limit of %d\n", CIL_PARSER_MAX_EXPR_DEPTH);
goto exit;
}

create_node(&node, *current, tok.line, *hll_offset, NULL);
insert_node(node, *current);
Expand Down

0 comments on commit ff143e5

Please sign in to comment.