[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4E601794.6080202@gmail.com>
Date: Fri, 02 Sep 2011 09:39:00 +1000
From: Ryan Mallon <rmallon@...il.com>
To: Mark Salter <msalter@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>
CC: linux-fsdevel@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] Check maxlen on strnlen_user usage
strnlen_user returns the length of the string including the nul
terminator. In the case where maxlen is reached strnlen_user returns
maxlen + 1. Most callsites already check for this condition. Fix the
call to strnlen_user in fs/exec.c to check for the maxlen case.
Signed-off-by: Ryan Mallon <rmallon@...il.com>
---
diff --git a/fs/exec.c b/fs/exec.c
index 25dcbe5..e19588c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -481,7 +481,7 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
goto out;
len = strnlen_user(str, MAX_ARG_STRLEN);
- if (!len)
+ if (!len || len> MAX_ARG_STRLEN)
goto out;
ret = -E2BIG;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists