提交 082ba88a 编写于 作者: R Roel Kluin 提交者: David S. Miller

atlx: strncpy does not null terminate string

strlcpy() will always null terminate the string.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <csnook@redhat.com>
Cc: Jie Yang <jie.yang@atheros.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5d5ceb8b
...@@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev, ...@@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev,
{ {
struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_adapter *adapter = netdev_priv(netdev);
strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver));
strncpy(drvinfo->version, atl1c_driver_version, strlcpy(drvinfo->version, atl1c_driver_version,
sizeof(drvinfo->version)); sizeof(drvinfo->version));
strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));
drvinfo->n_stats = 0; drvinfo->n_stats = 0;
drvinfo->testinfo_len = 0; drvinfo->testinfo_len = 0;
......
...@@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev, ...@@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev,
{ {
struct atl1_adapter *adapter = netdev_priv(netdev); struct atl1_adapter *adapter = netdev_priv(netdev);
strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
strncpy(drvinfo->version, ATLX_DRIVER_VERSION, strlcpy(drvinfo->version, ATLX_DRIVER_VERSION,
sizeof(drvinfo->version)); sizeof(drvinfo->version));
strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));
drvinfo->eedump_len = ATL1_EEDUMP_LEN; drvinfo->eedump_len = ATL1_EEDUMP_LEN;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册