libselinux: sefcontext_compile: handle newlines in file names

restorecon on file names with newlines are not handled properly.
Use PCRE_DOTALL so that dots in regular expressions match all
characters, and don't exclude the newline character.

See https://www.mail-archive.com/seandroid-list@tycho.nsa.gov/msg02001.html
for background.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
Stephen Smalley 2015-02-24 12:20:42 -05:00
parent 07ed7784cf
commit ae44b7bb39
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ static int process_file(struct saved_data *data, const char *filename)
spec_hasMetaChars(spec);
re = pcre_compile(anchored_regex, 0, &err, &erroff, NULL);
re = pcre_compile(anchored_regex, PCRE_DOTALL, &err, &erroff, NULL);
if (!re) {
fprintf(stderr, "PCRE compilation failed for %s at offset %d: %s\n", anchored_regex, erroff, err);
return -1;