From 235b6b00c564871680cee0a615761d9bcf6c5043 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 27 Jun 2011 11:05:39 +0100 Subject: [PATCH] Fix infoleak to userspace. Following Vasiliy Kulikov 's patch for the staging sources: 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: Ian Abbott --- comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index b07a34bb..29fbcb34 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -397,8 +397,8 @@ static int do_devinfo_ioctl(comedi_device * dev, comedi_devinfo * arg, /* 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; -- 2.26.2