Commit 4797489c authored by Ben Hutchings's avatar Ben Hutchings

x86_64: Fix strnlen_user() to not touch memory after specified maximum

Inspired by commit f18c34e4 ("lib: Fix strnlen_user() to not touch
memory after specified maximum") upstream.  This version of
strnlen_user(), no longer present upstream, has a similar off-by-one
error.
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Cc: Jan Kara <jack@suse.cz>
parent 48793a2e
......@@ -113,7 +113,7 @@ long __strnlen_user(const char __user *s, long n)
char c;
while (1) {
if (res>n)
if (res >= n)
return n+1;
if (__get_user(c, s))
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment