]> Pileus Git - ~andy/linux/commitdiff
usbip: Fix sscanf handling
authorAlan <gnomes@lxorguk.ukuu.org.uk>
Wed, 11 Dec 2013 18:32:59 +0000 (18:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2013 01:07:13 +0000 (17:07 -0800)
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>
drivers/staging/usbip/userspace/libsrc/usbip_common.c
drivers/staging/usbip/userspace/libsrc/vhci_driver.c

index 17e08e022c009e1ce49044229c1cf9747b1c74f0..66f03cc62ac6f28e99c4d47c4febda39e9b52d2e 100644 (file)
@@ -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;
index 1091bb20de11bcc874f2f4944b79c7f30dad75ec..241006a6cf742cf2c678fcac707494ee10c2ac62 100644 (file)
@@ -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);