selinux/libsepol/cil/src
James Carter 532469a251 libsepol/cil: Exit with an error if declaration name is a reserved word
When CIL parses sets or conditional expressions, any identifier that
matches an operator name will always be taken as an operator. If a
declaration has the same name as an operator, then there is the
possibility of causing either confusion or a syntax error if it is
used in an expression. The potential for problems is much greater
than any possible advantage in allowing a declaration to share the
name of a reserved word.

Create a new function, __cil_is_reserved_name() that is called when
an identifier is declared and its name is being validated. In this
function, check if the declaration has the same name as a reserved
word for an expression operator that can be used with the identifer's
flavor and exit with an error if it does.

Also, move the check for types, type aliases, and type attributes
matching the reserved word "self" to this new function.

Finally, change the name of the function __cil_verify_name() to
cil_verify_name(), since this function is neither static nor a
helper function.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-04-19 10:40:43 -04:00
..
cil.c libsepol/cil: constify some strings 2021-01-05 10:33:24 -05:00
cil_binary.c libsepol/cil: do not leak avrulex_ioctl_table memory when an error occurs 2021-03-17 08:46:36 +01:00
cil_binary.h libsepol/cil: remove unnecessary hash tables 2020-02-11 10:02:27 -05:00
cil_build_ast.c libsepol/cil: Exit with an error if declaration name is a reserved word 2021-04-19 10:40:43 -04:00
cil_build_ast.h
cil_copy_ast.c libsepol/cil: Check for duplicate blocks, optionals, and macros 2021-03-18 10:19:06 -04:00
cil_copy_ast.h
cil_find.c libsepol: include header files in source files when matching declarations 2021-02-05 10:19:34 +01:00
cil_find.h
cil_flavor.h
cil_fqn.c libsepol: include header files in source files when matching declarations 2021-02-05 10:19:34 +01:00
cil_fqn.h
cil_internal.h libsepol: fix CIL_KEY_* build errors with -fno-common 2020-01-27 10:51:14 -05:00
cil_lexer.h
cil_lexer.l
cil_list.c
cil_list.h
cil_log.c libsepol/cil: constify some strings 2021-01-05 10:33:24 -05:00
cil_log.h
cil_mem.c libsepol: include header files in source files when matching declarations 2021-02-05 10:19:34 +01:00
cil_mem.h libsepol: remove leftovers of cil_mem_error_handler 2020-01-27 10:51:18 -05:00
cil_parser.c libsepol/cil: Fix integer overflow in the handling of hll line marks 2021-02-10 08:06:10 -05:00
cil_parser.h libsepol/cil: constify some strings 2021-01-05 10:33:24 -05:00
cil_policy.c libsepol/cil: handle SID without assigned context when writing policy.conf 2021-02-24 11:22:12 +01:00
cil_policy.h
cil_post.c libsepol/cil: Fix out-of-bound read of file context pattern ending with "\" 2021-04-19 10:40:26 -04:00
cil_post.h libsepol/cil: make cil_post_fc_fill_data static 2021-03-17 08:46:33 +01:00
cil_reset_ast.c libsepol/cil: Set class field to NULL when resetting struct cil_classperms 2021-04-19 10:40:38 -04:00
cil_reset_ast.h
cil_resolve_ast.c libsepol/cil: fix NULL pointer dereference in __cil_insert_name 2021-03-17 08:46:36 +01:00
cil_resolve_ast.h
cil_stack.c
cil_stack.h
cil_strpool.c libsepol: remove leftovers of cil_mem_error_handler 2020-01-27 10:51:18 -05:00
cil_strpool.h
cil_symtab.c libsepol/cil: Update symtab nprim field when adding or removing datums 2021-01-20 16:53:38 +01:00
cil_symtab.h
cil_tree.c libsepol/cil: be more robust when encountering <src_info> 2021-02-16 09:30:53 -05:00
cil_tree.h
cil_verify.c libsepol/cil: Exit with an error if declaration name is a reserved word 2021-04-19 10:40:43 -04:00
cil_verify.h libsepol/cil: Exit with an error if declaration name is a reserved word 2021-04-19 10:40:43 -04:00