qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCHv2 15/22] target-i386: use pstrcpy, not strncpy


From: Jim Meyering
Subject: [Qemu-devel] [PATCHv2 15/22] target-i386: use pstrcpy, not strncpy
Date: Wed, 30 May 2012 09:46:34 +0200

From: Jim Meyering <address@hidden>

Use pstrcpy rather than strncpy in one more case
(in cpudef_setfield). This makes our handling of ->model_id
consistent with another pstrcpy-vs-model_id use below.

Signed-off-by: Jim Meyering <address@hidden>
---
 target-i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 388bc5c..722e597 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1275,7 +1275,7 @@ static int cpudef_setfield(const char *name, const char 
*str, void *opaque)
         g_free((void *)def->name);
         def->name = g_strdup(str);
     } else if (!strcmp(name, "model_id")) {
-        strncpy(def->model_id, str, sizeof (def->model_id));
+        pstrcpy(def->model_id, sizeof(def->model_id), str);
     } else if (!strcmp(name, "level")) {
         setscalar(&def->level, str, &err)
     } else if (!strcmp(name, "vendor")) {
-- 
1.7.10.2.605.gbefc5ed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]