diff options
author | Dmitry Kasatkin <d.kasatkin@samsung.com> | 2014-10-03 11:40:20 (GMT) |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2014-10-12 03:29:19 (GMT) |
commit | 7178784f0a94e2e6c668f587665fde41d405a23c (patch) | |
tree | 446106018f0d880b1e2dd3da0124bb3cfc03f5c3 /security/integrity/ima/ima_policy.c | |
parent | 272a6e90ffee1dea39efd6fdf9592edc83a0738e (diff) | |
download | linux-7178784f0a94e2e6c668f587665fde41d405a23c.tar.xz |
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: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_policy.c')
-rw-r--r-- | security/integrity/ima/ima_policy.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index bf232b9..d2c47d4 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -696,8 +696,9 @@ ssize_t ima_parse_add_rule(char *rule) p = strsep(&rule, "\n"); len = strlen(p) + 1; + p += strspn(p, " \t"); - if (*p == '#') + if (*p == '#' || *p == '\0') return len; entry = kzalloc(sizeof(*entry), GFP_KERNEL); |