audit: ignore terminating NUL in AUDIT_USER_TTY messages
A message that is not in the archive (sent off-list or not yet received): 573973171.1703051237470609326.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com
PATCH 1/1 audit: ignore terminating NUL in AUDIT_USER_TTY messages
Hello,
this appears to have been lost somewhere...
Mirek
From: Miloslav Trmac <[email protected]>
AUDIT_USER_TTY, like all other messages sent from user-space, is sent NUL-terminated. Unlike other user-space audit messages, which come only from trusted sources, AUDIT_USER_TTY messages are processed using audit_log_n_untrustedstring().
This patch modifies AUDIT_USER_TTY handling to ignore the trailing NUL and use the "quoted_string" representation of the message if possible.
Signed-off-by Miloslav Trmac <[email protected]>
Cc Eric Paris <[email protected]>
Cc Al Viro <[email protected]>
Cc Steve Grubb <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
kernel/audit.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/audit.c renamed from kernel/audit.c~audit-ignore-terminating-nul-in-audit_user_tty-messages +3 -0
@@ -763,6 +763,9 @@ static int audit_receive_msg(struct sk_baudit_log_format (ab," msg=" ); size =nlmsg_len (nlh); +if (size >0 && + ((unsigned char *)data)[size -1 ] =='\0' ) + size--;audit_log_n_untrustedstring (ab, data, size); }audit_set_pid (ab, pid);
_