From: Alan Date: Wed, 11 Dec 2013 18:32:59 +0000 (+0000) Subject: usbip: Fix sscanf handling X-Git-Tag: v3.2.99~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6d76df2094546ddf21489197b1a6833b0c16e40;p=thirdparty%2Fkernel%2Fstable.git usbip: Fix sscanf handling commit 2d32927127f44d755780aa5fa88c8c34e72558f8 upstream. 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c index 154b4b1103ec0..8751ebd7ccc42 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c @@ -164,7 +164,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 269787751b208..096e476a98ff2 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c @@ -66,7 +66,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);