]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] sysfs: zero terminate sysfs write buffers (CVE-2006-1055)
authorGreg Kroah-Hartman <gregkh@suse.de>
Fri, 31 Mar 2006 23:37:06 +0000 (15:37 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 7 Apr 2006 16:44:26 +0000 (09:44 -0700)
No one should be writing a PAGE_SIZE worth of data to a normal sysfs
file, so properly terminate the buffer.

Thanks to Al Viro for pointing out my stupidity here.

CVE-2006-1055 has been assigned for this.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/file.c

index d0e3d8495165205079ad8acef894744b517cfa18..2ecc58cc368a1a134b06e7fdad02f87daa43c97d 100644 (file)
@@ -183,7 +183,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t
                return -ENOMEM;
 
        if (count >= PAGE_SIZE)
-               count = PAGE_SIZE;
+               count = PAGE_SIZE - 1;
        error = copy_from_user(buffer->page,buf,count);
        buffer->needs_read_fill = 1;
        return error ? -EFAULT : count;