From: Dan Carpenter <dan.carpenter@oracle.com>
To: "James E.J. Bottomley" <JBottomley@parallels.com>,
Barak Witkowski <barak@broadcom.com>
Cc: Eddie Wai <eddie.wai@broadcom.com>,
Michael Chan <mchan@broadcom.com>,
linux-scsi@vger.kernel.org, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>
Subject: [patch] [SCSI] bnx2i: use strlcpy() instead of memcpy() for strings
Date: Sat, 30 Jun 2012 14:49:35 +0300 [thread overview]
Message-ID: <20120630114935.GB22767@elgon.mountain> (raw)
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;
next reply other threads:[~2012-06-30 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-30 11:49 Dan Carpenter [this message]
2012-07-02 10:09 ` [patch] [SCSI] bnx2i: use strlcpy() instead of memcpy() for strings 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120630114935.GB22767@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=JBottomley@parallels.com \
--cc=barak@broadcom.com \
--cc=davem@davemloft.net \
--cc=eddie.wai@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mchan@broadcom.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox