public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usbip:usbip_common.c: check return value of sscanf
@ 2014-03-06 23:51 John de la Garza
  2014-03-07  0:17 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: John de la Garza @ 2014-03-06 23:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-usb, devel

Added code to check return value of sscanf.

Signed-off-by: John de la Garza <john@jjdev.com>
---
 drivers/staging/usbip/usbip_common.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 4a2aab1..2a11233 100644
--- 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;
 	return count;
 }
 DEVICE_ATTR_RW(usbip_debug);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-07  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 23:51 [PATCH] usbip:usbip_common.c: check return value of sscanf John de la Garza
2014-03-07  0:17 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox