From: Roel Kluin <roel.kluin@gmail.com>
Cc: dm-devel@redhat.com, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] dm: strncpy does not null terminate string
Date: Fri, 17 Jul 2009 17:35:59 +0200 [thread overview]
Message-ID: <4A609A5F.70900@gmail.com> (raw)
In-Reply-To: <4A607185.6020302@gmail.com>
strlcpy() will always null terminate the string.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 7f77f18..8208b3a 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -634,9 +634,9 @@ static struct mapped_device *find_device(struct dm_ioctl *param)
* Sneakily write in both the name and the uuid
* while we have the cell.
*/
- strncpy(param->name, hc->name, sizeof(param->name));
+ strlcpy(param->name, hc->name, sizeof(param->name));
if (hc->uuid)
- strncpy(param->uuid, hc->uuid, sizeof(param->uuid)-1);
+ strlcpy(param->uuid, hc->uuid, sizeof(param->uuid));
else
param->uuid[0] = '\0';
next prev parent reply other threads:[~2009-07-17 15:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-17 12:41 [PATCH] powerpc/cell: strncpy does not null terminate string Roel Kluin
2009-07-17 14:27 ` Roel Kluin
2009-07-17 15:56 ` Arnd Bergmann
2009-07-21 9:31 ` Ken Kawakami
2009-07-17 15:05 ` Arnd Bergmann
2009-07-17 15:19 ` roel kluin
2009-07-17 15:35 ` Roel Kluin [this message]
2009-07-22 12:29 ` [PATCH] dm: " Alasdair G Kergon
2009-07-17 15:41 ` [PATCH] media: " Roel Kluin
2009-07-17 15:54 ` Roel Kluin
2009-07-17 18:01 ` [PATCH] b44: " Roel Kluin
2009-07-20 15:04 ` David Miller
2009-07-21 10:17 ` [PATCH] powerpc/cell: replace strncpy by strlcpy Roel Kluin
2009-07-22 4:22 ` Ken Kawakami
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=4A609A5F.70900@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dm-devel@redhat.com \
/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 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.