Commit 7178784f authored by Dmitry Kasatkin's avatar Dmitry Kasatkin Committed by Mimi Zohar

ima: ignore empty and with whitespaces policy lines

Empty policy lines cause parsing failures which is, especially
for new users, hard to spot. This patch prevents it.

Changes in v2:
* strip leading blanks and tabs in rules to prevent parsing failures
Signed-off-by: default avatarDmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
parent 272a6e90
...@@ -696,8 +696,9 @@ ssize_t ima_parse_add_rule(char *rule) ...@@ -696,8 +696,9 @@ ssize_t ima_parse_add_rule(char *rule)
p = strsep(&rule, "\n"); p = strsep(&rule, "\n");
len = strlen(p) + 1; len = strlen(p) + 1;
p += strspn(p, " \t");
if (*p == '#') if (*p == '#' || *p == '\0')
return len; return len;
entry = kzalloc(sizeof(*entry), GFP_KERNEL); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment