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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 06 Mar 2014 16:17:27 -0800
From:	Joe Perches <joe@...ches.com>
To:	John de la Garza <john@...ev.com>
Cc:	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
	devel@...verdev.osuosl.org
Subject: Re: [PATCH] usbip:usbip_common.c: check return value of sscanf

On Thu, 2014-03-06 at 15:51 -0800, John de la Garza wrote:
> Added code to check return value of sscanf.
[]
> diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
[]
> @@ -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;

Generally, it's probably better to convert these
sscanf uses to kstrto<foo>, kstrtoul in this case.


--
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