policycoreutils/hll/pp: fix '\n' parsing in filecon statements
Some module fc files do not contain a trailing new line. This caused contexts to have their last character to be deleted. When parsing each line from a fc file, we only strip off the last character if it is a new line. Signed-off-by: Yuli Khodorkovskiy <ykhodorkovskiy@tresys.com> Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
parent
f42d013eec
commit
836ffd988e
1 changed files with 3 additions and 1 deletions
|
@ -2756,7 +2756,9 @@ static int file_contexts_to_cil(struct sepol_module_package *mod_pkg)
|
|||
fp = fmemopen(fc, fc_len, "r");
|
||||
while ((line_len = getline(&line, &len, fp)) != -1) {
|
||||
buf = line;
|
||||
if (buf[line_len - 1] == '\n') {
|
||||
buf[line_len - 1] = '\0';
|
||||
}
|
||||
while (*buf && isspace(buf[0])) {
|
||||
buf++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue