]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usbip:usbip_common.c: check return value of sscanf
authorJohn de la Garza <john@jjdev.com>
Thu, 6 Mar 2014 23:51:59 +0000 (15:51 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 01:31:44 +0000 (17:31 -0800)
Added code to check return value of sscanf.

Signed-off-by: John de la Garza <john@jjdev.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/usbip/usbip_common.c

index 4a2aab16b10c7e092fc907d9f14b122328f6b701..2a11233d44f8d47bd3aa62da3107d8294e5e8bf1 100644 (file)
@@ -55,7 +55,8 @@ static ssize_t usbip_debug_store(struct device *dev,
                                 struct device_attribute *attr, const char *buf,
                                 size_t count)
 {
-       sscanf(buf, "%lx", &usbip_debug_flag);
+       if (sscanf(buf, "%lx", &usbip_debug_flag) != 1)
+               return -EINVAL;
        return count;
 }
 DEVICE_ATTR_RW(usbip_debug);