Skip to content

Commit

Permalink
bnx2i: use strlcpy() instead of memcpy() for strings
Browse files Browse the repository at this point in the history
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>
Acked-by: Michael Chan <mchan@broadcom.com>
Acked-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Jul 9, 2012
1 parent 8f961fa commit 12aba9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/bnx2i/bnx2i_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 12aba9e

Please sign in to comment.