mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
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>
This commit is contained in:
parent
9d020a2e5f
commit
7459b6ff36
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user