From: Alexander Viro Subject: [PATCH 1/4] proc_loginuid_write() uses simple_strtoul() on non-terminated array Date: Fri, 19 May 2006 17:32:47 -0400 Message-ID: <200605192132.k4JLWleC008849@devserv.devel.redhat.com> Return-path: Received: from devserv.devel.redhat.com (devserv.devel.redhat.com [172.16.58.1]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k4JLWl6t024011 for ; Fri, 19 May 2006 17:32:47 -0400 Received: from devserv.devel.redhat.com (localhost.localdomain [127.0.0.1]) by devserv.devel.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k4JLWlpV008864 for ; Fri, 19 May 2006 17:32:47 -0400 Received: (from aviro@localhost) by devserv.devel.redhat.com (8.12.11.20060308/8.12.11/Submit) id k4JLWleC008849 for linux-audit@redhat.com; Fri, 19 May 2006 17:32:47 -0400 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com Signed-off-by: Al Viro --- fs/proc/base.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) b464a96dd7aae91ac0399d93f7cb2fbb6dfc3dfe 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(struc 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(struc 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; -- 1.3.GIT