netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: strncpy does not null terminate string
       [not found] <4A607185.6020302@gmail.com>
@ 2009-07-17 15:54 ` Roel Kluin
  2009-07-17 18:01 ` [PATCH] b44: " Roel Kluin
  1 sibling, 0 replies; 3+ messages in thread
From: Roel Kluin @ 2009-07-17 15:54 UTC (permalink / raw)
  To: zambrano, netdev, Andrew Morton

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>
---
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 36d4d37..1f7f015 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -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;
 	}
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] b44: strncpy does not null terminate string
       [not found] <4A607185.6020302@gmail.com>
  2009-07-17 15:54 ` [PATCH] media: strncpy does not null terminate string Roel Kluin
@ 2009-07-17 18:01 ` Roel Kluin
  2009-07-20 15:04   ` David Miller
  1 sibling, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-07-17 18:01 UTC (permalink / raw)
  To: zambrano, David Miller, netdev, Andrew Morton

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>
---
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 36d4d37..1f7f015 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -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;
 	}
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] b44: strncpy does not null terminate string
  2009-07-17 18:01 ` [PATCH] b44: " Roel Kluin
@ 2009-07-20 15:04   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-07-20 15:04 UTC (permalink / raw)
  To: roel.kluin; +Cc: zambrano, netdev, akpm

From: Roel Kluin <roel.kluin@gmail.com>
Date: Fri, 17 Jul 2009 20:01:54 +0200

> 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>

Applied to net-next-2.6

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-20 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4A607185.6020302@gmail.com>
2009-07-17 15:54 ` [PATCH] media: strncpy does not null terminate string Roel Kluin
2009-07-17 18:01 ` [PATCH] b44: " Roel Kluin
2009-07-20 15:04   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).