* [PATCH] Check maxlen on strnlen_user usage
@ 2011-09-01 23:39 Ryan Mallon
0 siblings, 0 replies; only message in thread
From: Ryan Mallon @ 2011-09-01 23:39 UTC (permalink / raw)
To: Mark Salter, Alexander Viro; +Cc: linux-fsdevel, linux-kernel@vger.kernel.org
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@gmail.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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-01 23:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01 23:39 [PATCH] Check maxlen on strnlen_user usage Ryan Mallon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.