linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] audit: Fix check of return value of strnlen_user()
@ 2015-06-02 15:08 Jan Kara
  2015-06-03 18:56 ` Paul Moore
  2015-06-11 19:58 ` Paul Moore
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Kara @ 2015-06-02 15:08 UTC (permalink / raw)
  To: linux-audit; +Cc: Jan Kara

strnlen_user() returns 0 when it hits fault, not -1. Fix the test in
audit_log_single_execve_arg(). Luckily this shouldn't ever happen unless
there's a kernel bug so it's mostly a cosmetic fix.

CC: Paul Moore <pmoore@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 kernel/auditsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 9fb9d1cb83ce..bb947ceeee4d 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1023,7 +1023,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
 	 * for strings that are too long, we should not have created
 	 * any.
 	 */
-	if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
+	if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
 		WARN_ON(1);
 		send_sig(SIGKILL, current, 0);
 		return -1;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-11 19:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 15:08 [PATCH] audit: Fix check of return value of strnlen_user() Jan Kara
2015-06-03 18:56 ` Paul Moore
2015-06-04  7:36   ` Jan Kara
2015-06-04 13:18     ` Paul Moore
2015-06-04 21:32       ` Jan Kara
2015-06-04 21:48         ` Paul Moore
2015-06-11 19:58 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).