From: Al Viro Date: Thu, 18 May 2006 12:28:02 +0000 (-0400) Subject: [PATCH] proc_loginuid_write() uses simple_strtoul() on non-terminated array X-Git-Tag: v3.12-rc1~35877^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0182909297da8d38a5d473ae7bee3d0324632a1;p=kernel%2Fkernel-generic.git [PATCH] proc_loginuid_write() uses simple_strtoul() on non-terminated array Signed-off-by: Al Viro --- diff --git a/fs/proc/base.c b/fs/proc/base.c index 6cc77dc..6afff72 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1019,8 +1019,8 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, if (current != task) return -EPERM; - if (count > PAGE_SIZE) - count = PAGE_SIZE; + if (count >= PAGE_SIZE) + count = PAGE_SIZE - 1; if (*ppos != 0) { /* No partial writes. */ @@ -1033,6 +1033,7 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, if (copy_from_user(page, buf, count)) goto out_free_page; + page[count] = '\0'; loginuid = simple_strtoul(page, &tmp, 10); if (tmp == page) { length = -EINVAL;