Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usbnet: sanitise overlong driver information strings

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>

authored by

Phil Sutter and committed by
David S. Miller
86a2f415 0b3f0e7a

+3 -3
+3 -3
drivers/net/usb/usbnet.c
··· 876 876 { 877 877 struct usbnet *dev = netdev_priv(net); 878 878 879 - strncpy (info->driver, dev->driver_name, sizeof info->driver); 880 - strncpy (info->version, DRIVER_VERSION, sizeof info->version); 881 - strncpy (info->fw_version, dev->driver_info->description, 879 + strlcpy (info->driver, dev->driver_name, sizeof info->driver); 880 + strlcpy (info->version, DRIVER_VERSION, sizeof info->version); 881 + strlcpy (info->fw_version, dev->driver_info->description, 882 882 sizeof info->fw_version); 883 883 usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); 884 884 }