audit: Handle embedded NUL in TTY input auditing

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 10:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7459b6...
Commit:     7459b6ff36ab5e7d160980c3cb2be2f8cd194778
Parent:     9d020a2e5fd2c79f5b08a6cab2b02e7231d7cb84
Author:     Miloslav Trmac <mitr@redhat.com>
AuthorDate: Mon Oct 13 10:35:15 2008 +0100
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Mon Oct 13 09:51:39 2008 -0700

    audit: Handle embedded NUL in TTY input auditing
    
    Data read from a TTY can contain an embedded NUL byte (e.g. after
    pressing Ctrl-2, or sent to a PTY).  After the previous patch, the data
    would be logged only up to the first NUL.
    
    This patch modifies the AUDIT_TTY record to always use the hexadecimal
    format, which does not terminate at the first NUL byte.  The vast
    majority of recorded TTY input data will contain either ' ' or '\n', so
    the hexadecimal format would have been used anyway.
    
    Signed-off-by: Miloslav Trmac <mitr@redhat.com>
    Signed-off-by: Alan Cox <alan@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 drivers/char/tty_audit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/tty_audit.c b/drivers/char/tty_audit.c
index 3582f43..5787249 100644
--- a/drivers/char/tty_audit.c
+++ b/drivers/char/tty_audit.c
@@ -93,7 +93,7 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid,
 		get_task_comm(name, tsk);
 		audit_log_untrustedstring(ab, name);
 		audit_log_format(ab, " data=");
-		audit_log_n_untrustedstring(ab, buf->data, buf->valid);
+		audit_log_n_hex(ab, buf->data, buf->valid);
 		audit_log_end(ab);
 	}
 	buf->valid = 0;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
audit: Handle embedded NUL in TTY input auditing, Linux Kernel Mailing ..., (Mon Oct 13, 10:59 am)