Commit 2d329271 authored by Alan's avatar Alan Committed by Greg Kroah-Hartman

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: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 66a01f11
...@@ -165,7 +165,7 @@ int read_attr_speed(struct sysfs_device *dev) ...@@ -165,7 +165,7 @@ int read_attr_speed(struct sysfs_device *dev)
goto err; goto err;
} }
ret = sscanf(attr->value, "%s\n", speed); ret = sscanf(attr->value, "%99s\n", speed);
if (ret < 1) { if (ret < 1) {
dbg("sscanf failed"); dbg("sscanf failed");
goto err; goto err;
......
...@@ -72,7 +72,7 @@ static int parse_status(char *value) ...@@ -72,7 +72,7 @@ static int parse_status(char *value)
unsigned long socket; unsigned long socket;
char lbusid[SYSFS_BUS_ID_SIZE]; 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, &port, &status, &speed,
&devid, &socket, lbusid); &devid, &socket, lbusid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment