libselinux: pcre_study can return NULL without error.

Per the man page, pcre_study can return NULL without error if
it could not find any additional information.  Errors are indicated
by the combination of a NULL return value and a non-NULL error string.
Fix the handling so that we do not incorrectly reject file_contexts
entries.

Change-Id: I2e7b7e01d85d96dd7fe78545d3ee3834281c4eba
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
Stephen Smalley 2015-02-02 17:11:45 -05:00
parent eb0ba200b5
commit 1434267419

View File

@ -138,7 +138,7 @@ static int compile_regex(struct saved_data *data, struct spec *spec, const char
}
spec->sd = pcre_study(spec->regex, 0, &tmperrbuf);
if (!spec->sd) {
if (!spec->sd && tmperrbuf) {
if (errbuf)
*errbuf=tmperrbuf;
return -1;