diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 15:36:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 15:36:11 -0400 |
commit | 0221c81b1b8eb0cbb6b30a0ced52ead32d2b4e4c (patch) | |
tree | fe96cf58638e23d123d43eab2f6c56d1af341d9c /kernel/audit.c | |
parent | 48f286a28fe13fcbc510720fcffb872a184b51dd (diff) | |
parent | def57543418a5f47debae28a0a9dea2effc11692 (diff) |
Merge branch 'audit.b62' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current
* 'audit.b62' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
Audit: remove spaces from audit_log_d_path
audit: audit_set_auditable defined but not used
audit: incorrect ref counting in audit tree tag_chunk
audit: Fix possible return value truncation in audit_get_context()
audit: ignore terminating NUL in AUDIT_USER_TTY messages
Audit: fix handling of 'strings' with NULL characters
make the e->rule.xxx shorter in kernel auditfilter.c
auditsc: fix kernel-doc notation
audit: EXECVE record - removed bogus newline
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index ce6d8ea3131..9442c3533ba 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -766,6 +766,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
766 | 766 | ||
767 | audit_log_format(ab, " msg="); | 767 | audit_log_format(ab, " msg="); |
768 | size = nlmsg_len(nlh); | 768 | size = nlmsg_len(nlh); |
769 | if (size > 0 && | ||
770 | ((unsigned char *)data)[size - 1] == '\0') | ||
771 | size--; | ||
769 | audit_log_n_untrustedstring(ab, data, size); | 772 | audit_log_n_untrustedstring(ab, data, size); |
770 | } | 773 | } |
771 | audit_set_pid(ab, pid); | 774 | audit_set_pid(ab, pid); |
@@ -1382,7 +1385,7 @@ void audit_log_n_string(struct audit_buffer *ab, const char *string, | |||
1382 | int audit_string_contains_control(const char *string, size_t len) | 1385 | int audit_string_contains_control(const char *string, size_t len) |
1383 | { | 1386 | { |
1384 | const unsigned char *p; | 1387 | const unsigned char *p; |
1385 | for (p = string; p < (const unsigned char *)string + len && *p; p++) { | 1388 | for (p = string; p < (const unsigned char *)string + len; p++) { |
1386 | if (*p == '"' || *p < 0x21 || *p > 0x7e) | 1389 | if (*p == '"' || *p < 0x21 || *p > 0x7e) |
1387 | return 1; | 1390 | return 1; |
1388 | } | 1391 | } |
@@ -1437,13 +1440,13 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix, | |||
1437 | /* We will allow 11 spaces for ' (deleted)' to be appended */ | 1440 | /* We will allow 11 spaces for ' (deleted)' to be appended */ |
1438 | pathname = kmalloc(PATH_MAX+11, ab->gfp_mask); | 1441 | pathname = kmalloc(PATH_MAX+11, ab->gfp_mask); |
1439 | if (!pathname) { | 1442 | if (!pathname) { |
1440 | audit_log_format(ab, "<no memory>"); | 1443 | audit_log_string(ab, "<no_memory>"); |
1441 | return; | 1444 | return; |
1442 | } | 1445 | } |
1443 | p = d_path(path, pathname, PATH_MAX+11); | 1446 | p = d_path(path, pathname, PATH_MAX+11); |
1444 | if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ | 1447 | if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ |
1445 | /* FIXME: can we save some information here? */ | 1448 | /* FIXME: can we save some information here? */ |
1446 | audit_log_format(ab, "<too long>"); | 1449 | audit_log_string(ab, "<too_long>"); |
1447 | } else | 1450 | } else |
1448 | audit_log_untrustedstring(ab, p); | 1451 | audit_log_untrustedstring(ab, p); |
1449 | kfree(pathname); | 1452 | kfree(pathname); |