All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] [SCSI] bnx2i: use strlcpy() instead of memcpy() for strings
@ 2012-06-30 11:49 Dan Carpenter
  2012-07-02 10:09   ` David Laight
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2012-06-30 11:49 UTC (permalink / raw)
  To: James E.J. Bottomley, Barak Witkowski
  Cc: Eddie Wai, Michael Chan, linux-scsi, netdev, David S. Miller

DRV_MODULE_VERSION here is "2.7.2.2" which is only 8 chars but we copy
12 bytes from the stack so it's a small information leak.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This was just added to linux-next yesterday, but I'm not sure which tree
it came from.

diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 7729a52..b17637a 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -400,7 +400,7 @@ int bnx2i_get_stats(void *handle)
 	if (!stats)
 		return -ENOMEM;
 
-	memcpy(stats->version, DRV_MODULE_VERSION, sizeof(stats->version));
+	strlcpy(stats->version, DRV_MODULE_VERSION, sizeof(stats->version));
 	memcpy(stats->mac_add1 + 2, hba->cnic->mac_addr, ETH_ALEN);
 
 	stats->max_frame_size = hba->netdev->mtu;

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

end of thread, other threads:[~2012-07-09  6:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-30 11:49 [patch] [SCSI] bnx2i: use strlcpy() instead of memcpy() for strings Dan Carpenter
2012-07-02 10:09 ` David Laight
2012-07-02 10:09   ` David Laight
2012-07-02 10:48   ` Dan Carpenter
2012-07-02 15:13     ` Michael Chan
2012-07-02 17:53       ` Eddie Wai
2012-07-09  6:51       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.