Skip to content

Commit 819cbb1

Browse files
segoongregkh
authored andcommitted
staging: comedi: fix infoleak to userspace
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> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 85678d5 commit 819cbb1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/staging/comedi/comedi_fops.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ static int do_devinfo_ioctl(struct comedi_device *dev,
383383
/* fill devinfo structure */
384384
devinfo.version_code = COMEDI_VERSION_CODE;
385385
devinfo.n_subdevs = dev->n_subdevices;
386-
memcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);
387-
memcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);
386+
strlcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);
387+
strlcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);
388388

389389
if (read_subdev)
390390
devinfo.read_subdevice = read_subdev - dev->subdevices;

0 commit comments

Comments
 (0)