]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: fix infoleak to userspace
authorVasiliy Kulikov <segoon@openwall.com>
Sun, 26 Jun 2011 08:56:22 +0000 (12:56 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 8 Aug 2011 17:35:53 +0000 (10:35 -0700)
commit 819cbb120eaec7e014e5abd029260db1ca8c5735 upstream.

driver_name and board_name are pointers to strings, not buffers of size
COMEDI_NAMELEN.  Copying COMEDI_NAMELEN bytes of a string containing
less than COMEDI_NAMELEN-1 bytes would leak some unrelated bytes.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/comedi_fops.c

index 8117748ad5a5ec50fd1ea2963adc3078b1ab8632..18610b03fa97b9efa876f28e40a87f03903ba67a 100644 (file)
@@ -362,8 +362,8 @@ static int do_devinfo_ioctl(struct comedi_device *dev,
        /* fill devinfo structure */
        devinfo.version_code = COMEDI_VERSION_CODE;
        devinfo.n_subdevs = dev->n_subdevices;
-       memcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);
-       memcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);
+       strlcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);
+       strlcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);
 
        if (read_subdev)
                devinfo.read_subdevice = read_subdev - dev->subdevices;