* [Qemu-devel] [4727] using strncpy is *always* a bad idea
@ 2008-06-11 9:44 Fabrice Bellard
0 siblings, 0 replies; only message in thread
From: Fabrice Bellard @ 2008-06-11 9:44 UTC (permalink / raw)
To: qemu-devel
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-06-11 9:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-11 9:44 [Qemu-devel] [4727] using strncpy is *always* a bad idea Fabrice Bellard
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).