Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760609AbYJMJkP (ORCPT ); Mon, 13 Oct 2008 05:40:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759067AbYJMJf3 (ORCPT ); Mon, 13 Oct 2008 05:35:29 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:56163 "EHLO lxorguk.ukuu.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759040AbYJMJf1 (ORCPT ); Mon, 13 Oct 2008 05:35:27 -0400 From: Alan Cox Subject: [PATCH 21/80] audit: Handle embedded NUL in TTY input auditing To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Date: Mon, 13 Oct 2008 10:35:15 +0100 Message-ID: <20081013093510.21645.24519.stgit@localhost.localdomain> In-Reply-To: <20081013092758.21645.2359.stgit@localhost.localdomain> References: <20081013092758.21645.2359.stgit@localhost.localdomain> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1413 Lines: 38 From: Miloslav Trmac 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 Signed-off-by: Alan Cox --- 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 linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/