lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 06 Mar 2014 13:23:09 -0700 From: Shuah Khan <shuah.kh@...sung.com> To: John de la Garza <john@...ev.com>, linux-kernel@...r.kernel.org Cc: gregkh@...uxfoundation.org, Shuah Khan <shuah.kh@...sung.com> Subject: Re: [PATCH] usbip:vhci_sysfs.c: check return value of sscanf On 03/06/2014 11:36 AM, John de la Garza wrote: > Added code to check return value of sscanf. > > Signed-off-by: John de la Garza <john@...ev.com> > --- > drivers/staging/usbip/vhci_sysfs.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c > index 03e6edf..82dd49f 100644 > --- a/drivers/staging/usbip/vhci_sysfs.c > +++ b/drivers/staging/usbip/vhci_sysfs.c > @@ -114,7 +114,8 @@ static ssize_t store_detach(struct device *dev, struct device_attribute *attr, > int err; > __u32 rhport = 0; > > - sscanf(buf, "%u", &rhport); > + if (sscanf(buf, "%u", &rhport) != 1) > + return -EINVAL; > > /* check rhport */ > if (rhport >= VHCI_NPORTS) { > @@ -182,7 +183,8 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, > * @devid: unique device identifier in a remote host > * @speed: usb device speed in a remote host > */ > - sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed); > + if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1) > + return -EINVAL; > > usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n", > rhport, sockfd, devid, speed); > Looks good to me. Reviewed-by: Shuah Khan <shuah.kh@...sung.com> -- Shuah -- Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) shuah.kh@...sung.com | (970) 672-0658 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists