summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbellard2008-06-11 11:44:44 +0200
committerbellard2008-06-11 11:44:44 +0200
commitae45d3693b49de05b472c00fbe0d6e3ff5d16ecc (patch)
tree1ad213bbed5e1022c13a771e061d40dc15d8bf8b
parentFix typo, by Laurent Desnogues. (diff)
downloadqemu-ae45d3693b49de05b472c00fbe0d6e3ff5d16ecc.tar.gz
qemu-ae45d3693b49de05b472c00fbe0d6e3ff5d16ecc.tar.xz
qemu-ae45d3693b49de05b472c00fbe0d6e3ff5d16ecc.zip
using strncpy is *always* a bad idea
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4727 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/vl.c b/vl.c
index 18ddcce1f9..671b7a41d9 100644
--- a/vl.c
+++ b/vl.c
@@ -3394,8 +3394,7 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str,
#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 @@ static int drive_init(struct drive_opt *arg, int snapshot,
}
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;