usbnet: sanitise overlong driver information strings
authorPhil Sutter <phil.sutter@viprinet.com>
Thu, 14 Jun 2012 01:18:42 +0000 (01:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Jun 2012 23:20:31 +0000 (16:20 -0700)
As seen on smsc75xx, driver_info->description being longer than 32
characters messes up 'ethtool -i' output.

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/usbnet.c

index 9f58330f1312059d37deeb072b2d5c32d3d6df03..d4f7256a607dafd882065d4379198a60f2aff92f 100644 (file)
@@ -876,9 +876,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
 {
        struct usbnet *dev = netdev_priv(net);
 
-       strncpy (info->driver, dev->driver_name, sizeof info->driver);
-       strncpy (info->version, DRIVER_VERSION, sizeof info->version);
-       strncpy (info->fw_version, dev->driver_info->description,
+       strlcpy (info->driver, dev->driver_name, sizeof info->driver);
+       strlcpy (info->version, DRIVER_VERSION, sizeof info->version);
+       strlcpy (info->fw_version, dev->driver_info->description,
                sizeof info->fw_version);
        usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
 }