Message ID | 20210810180537.669439-3-jwcart2@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | libsepol/cil: Line mark cleanup and fix | expand |
diff --git a/libsepol/cil/src/cil_parser.c b/libsepol/cil/src/cil_parser.c index fb95f401..fc90caec 100644 --- a/libsepol/cil/src/cil_parser.c +++ b/libsepol/cil/src/cil_parser.c @@ -111,6 +111,10 @@ static int add_hll_linemark(struct cil_tree_node **current, uint32_t *hll_lineno unsigned long val; cil_lexer_next(&tok); + if (tok.type != SYMBOL) { + cil_log(CIL_ERR, "Invalid line mark syntax\n"); + goto exit; + } hll_type = cil_strpool_add(tok.value); if (hll_type == CIL_KEY_HLL_LME) { if (cil_stack_is_empty(stack)) {
In add_hll_linemark(), cil_lexer_next() is called and the token type is not checked after the call for the expected type (SYMBOL). Check that the token type is SYMBOL after calling cil_lexer_next(). Signed-off-by: James Carter <jwcart2@gmail.com> --- libsepol/cil/src/cil_parser.c | 4 ++++ 1 file changed, 4 insertions(+)