mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-12-03 09:00:51 +00:00
3dd5dd8a07
When load_users() parses an invalid line with an empty level context (ie. nothing between "level" and "range" keywords), it allocates memory with malloc(0) and uses it. The behavior of malloc() in this case is an unspecified behavior: it might return NULL, which would lead to a segmentation fault. Fix this issue by reporting the invalid entry instead. While at it, ensure that the character before "range" is a space, and change the logic slightly in order to avoid using "--p; ... p++;". This issue is reported by clang's static analyzer with the following message: genusers.c:222:11: warning: Use of zero-allocated memory *r++ = *s; ^ genusers.c:225:7: warning: Use of zero-allocated memory *r = 0; ^ Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> |
||
---|---|---|
.. | ||
cil | ||
include | ||
man | ||
src | ||
tests | ||
utils | ||
.gitignore | ||
COPYING | ||
Makefile | ||
VERSION |