From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4727] using strncpy is *always* a bad idea
Date: Wed, 11 Jun 2008 09:44:45 +0000 [thread overview]
Message-ID: <E1K6Msm-0003A9-W5@cvs.savannah.gnu.org> (raw)
Revision: 4727
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4727
Author: bellard
Date: 2008-06-11 09:44:44 +0000 (Wed, 11 Jun 2008)
Log Message:
-----------
using strncpy is *always* a bad idea
Modified Paths:
--------------
trunk/vl.c
Modified: trunk/vl.c
===================================================================
--- trunk/vl.c 2008-06-10 15:29:15 UTC (rev 4726)
+++ trunk/vl.c 2008-06-11 09:44:44 UTC (rev 4727)
@@ -3394,8 +3394,7 @@
#ifndef _WIN32
if (is_unix) {
char path[109];
- strncpy(path, uaddr.sun_path, 108);
- path[108] = 0;
+ pstrcpy(path, sizeof(path), uaddr.sun_path);
unlink(path);
} else
#endif
@@ -5075,7 +5074,7 @@
}
if (get_param_value(buf, sizeof(buf), "if", str)) {
- strncpy(devname, buf, sizeof(devname));
+ pstrcpy(devname, sizeof(devname), buf);
if (!strcmp(buf, "ide")) {
type = IF_IDE;
max_devs = MAX_IDE_DEVS;
reply other threads:[~2008-06-11 9:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1K6Msm-0003A9-W5@cvs.savannah.gnu.org \
--to=fabrice@bellard.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).