From b11b2e1bdd18ba5cd0dde075d440b3894e6ce64f Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Sat, 2 Feb 2013 15:57:53 +0800 Subject: [PATCH] drivers/usb/core: using strlcpy instead of strncpy for NUL terminated string, better notice '\0' in the end. Signed-off-by: Chen Gang Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/devio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index b78fbe2..4a863fd 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include /* for usbcore internals */ @@ -1077,7 +1078,7 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg) if (!intf || !intf->dev.driver) ret = -ENODATA; else { - strncpy(gd.driver, intf->dev.driver->name, + strlcpy(gd.driver, intf->dev.driver->name, sizeof(gd.driver)); ret = (copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0); } -- 2.7.4