diff options
author | Alan <gnomes@lxorguk.ukuu.org.uk> | 2013-12-11 18:32:59 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-17 17:07:13 -0800 |
commit | 2d32927127f44d755780aa5fa88c8c34e72558f8 (patch) | |
tree | 7a7f48e6b54f7b34422fb999138a417a49389afc /drivers/staging/usbip | |
parent | 66a01f1158cf5dbe18dd2d5db7bb24080363ae21 (diff) | |
download | lwn-2d32927127f44d755780aa5fa88c8c34e72558f8.tar.gz lwn-2d32927127f44d755780aa5fa88c8c34e72558f8.zip |
usbip: Fix sscanf handling
Scan only to the length permitted by the buffer
One of a set of sscanf problems noted by Jackie Chang
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/usbip')
-rw-r--r-- | drivers/staging/usbip/userspace/libsrc/usbip_common.c | 2 | ||||
-rw-r--r-- | drivers/staging/usbip/userspace/libsrc/vhci_driver.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c index 17e08e022c00..66f03cc62ac6 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c @@ -165,7 +165,7 @@ int read_attr_speed(struct sysfs_device *dev) goto err; } - ret = sscanf(attr->value, "%s\n", speed); + ret = sscanf(attr->value, "%99s\n", speed); if (ret < 1) { dbg("sscanf failed"); goto err; diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c index 1091bb20de11..241006a6cf74 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c @@ -72,7 +72,7 @@ static int parse_status(char *value) unsigned long socket; char lbusid[SYSFS_BUS_ID_SIZE]; - ret = sscanf(c, "%d %d %d %x %lx %s\n", + ret = sscanf(c, "%d %d %d %x %lx %31s\n", &port, &status, &speed, &devid, &socket, lbusid); |