]> git.proxmox.com Git - mirror_qemu.git/blobdiff - qemu-malloc.c
target-ppc: fix srw on 64-bit targets
[mirror_qemu.git] / qemu-malloc.c
index 606eda6ff0bcf245665fc2ba772ad2fdcd733d73..3bffae1fbb0384384f5391e13766b8b9e1623afb 100644 (file)
@@ -56,9 +56,10 @@ void *qemu_mallocz(size_t size)
 char *qemu_strdup(const char *str)
 {
     char *ptr;
-    ptr = qemu_malloc(strlen(str) + 1);
+    size_t len = strlen(str);
+    ptr = qemu_malloc(len + 1);
     if (!ptr)
         return NULL;
-    strcpy(ptr, str);
+    pstrcpy(ptr, len + 1, str);
     return ptr;
 }