Skip to content

Commit

Permalink
b44: strncpy does not null terminate string
Browse files Browse the repository at this point in the history
strlcpy() will always null terminate the string. Also use the
sizeof(version) to strlcopy() the version string.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
roel kluin authored and David S. Miller committed Jul 20, 2009
1 parent b902e57 commit 27e0955
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/b44.c
Original file line number Diff line number Diff line change
Expand Up @@ -1756,15 +1756,15 @@ static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *inf
struct b44 *bp = netdev_priv(dev);
struct ssb_bus *bus = bp->sdev->bus;

strncpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
strncpy(info->version, DRV_MODULE_VERSION, sizeof(info->driver));
strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
switch (bus->bustype) {
case SSB_BUSTYPE_PCI:
strncpy(info->bus_info, pci_name(bus->host_pci), sizeof(info->bus_info));
strlcpy(info->bus_info, pci_name(bus->host_pci), sizeof(info->bus_info));
break;
case SSB_BUSTYPE_PCMCIA:
case SSB_BUSTYPE_SSB:
strncpy(info->bus_info, "SSB", sizeof(info->bus_info));
strlcpy(info->bus_info, "SSB", sizeof(info->bus_info));
break;
}
}
Expand Down

0 comments on commit 27e0955

Please sign in to comment.