If the last line of a file_contexts file is not '\n' terminated it failed to read the entry and gave an invalid file type error. read_spec_entries now handles this situation. Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx> --- libselinux/src/label_support.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libselinux/src/label_support.c b/libselinux/src/label_support.c index cf91dfa..e67d89a 100644 --- a/libselinux/src/label_support.c +++ b/libselinux/src/label_support.c @@ -57,6 +57,11 @@ int hidden read_spec_entries(char *line_buf, int num_args, ...) len = strlen(line_buf); if (line_buf[len - 1] == '\n') line_buf[len - 1] = '\0'; + else + /* Handle case if line not \n terminated by bumping + * the len for the check below (as the line is NUL + * terminated by getline(3)) */ + len++; buf_p = line_buf; while (isspace(*buf_p)) -- 2.1.0 _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.