mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-05 04:59:42 +00:00
bdf4e332b4
OSS-Fuzz found a NULL pointer dereference when the CIL compiler tries to compile a policy with an invalid integer: $ echo '(ioportcon(2())n)' > tmp.cil $ secilc tmp.cil Segmentation fault (core dumped) This is because strtol() is called with a NULL pointer, in cil_fill_integer(). Fix this by checking that int_node->data is not NULL. While at it, use strtoul() instead of strtol() to parse an unsigned integer. When using "val > UINT32_MAX" with "unsigned long val;", it is expected that some compilers emit a warning when the size of "unsigned long" is 32 bits. In theory gcc could be such a compiler (with warning -Wtype-limits, which is included in -Wextra). Nevertheless this is currently broken, according to https://gcc.gnu.org/pipermail/gcc-help/2021-January/139755.html and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89126 (this bug was opened in January 2019). In order to prevent this warning from appearing, introduce some preprocessor macros around the bound check. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28456 Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> Acked-by: James Carter <jwcart2@gmail.com> |
||
---|---|---|
.. | ||
cil | ||
include | ||
man | ||
src | ||
tests | ||
utils | ||
.gitignore | ||
COPYING | ||
Makefile | ||
VERSION |