selinux/libselinux
Nicolas Iooss c56bb631c4 libselinux: label_file: fix memory management in store_stem()
If store_stem() fails to expand the memory allocated on data->stem_arr,
some things go wrong:
* the memory referenced by "buf" is leaked,
* data->alloc_stems has been increased without data->stem_arr having
  been expanded. So the next time store_stem() is called, the function
  will behave as if the buffer holds enough space, and will write data
  after the end of data->stem_arr.

The first issue is being spotted by clang's static analyzer, which warns
about leaking variable "stem" in find_stem_from_spec() (this function
calls store_stem()).

This both issues by freeing buf when realloc(data->stem_arr) fails, and
by not increasing data->alloc_stems when this happens.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2018-04-17 13:55:57 -07:00
..
include libselinux: build: follow standard semantics for DESTDIR and PREFIX 2018-02-14 15:59:36 +01:00
man libselinux: build: follow standard semantics for DESTDIR and PREFIX 2018-02-14 15:59:36 +01:00
src libselinux: label_file: fix memory management in store_stem() 2018-04-17 13:55:57 -07:00
utils libselinux: build: follow standard semantics for DESTDIR and PREFIX 2018-02-14 15:59:36 +01:00
LICENSE initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
Makefile libselinux: Add support for pcre2 to pkgconfig definition 2017-10-13 15:24:23 -04:00
VERSION Update VERSION files for 2.7 release. 2017-08-04 09:31:00 -04:00