qemu_strdup() doesn't copy alast character
PATCH 1/1 qemu_strdup() doesn't copy alast character
Because of off by one error.
Signed-off-by Gleb Natapov <[email protected]>
qemu-malloc.c +1 -1
@@ -60,6 +60,6 @@ char *qemu_strdup(const char *str) ptr =qemu_malloc (len +1 );if (!ptr)return NULL ; -pstrcpy (ptr, len, str); +pstrcpy (ptr, len +1 , str);return ptr; }
--
Gleb.
Blue Swirl
AppliedQuoted 11 lines · Gleb Natapov
Because of off by one error.
Signed-off-by Gleb Natapov <[email protected]>diff --git
a/qemu-malloc.cb/qemu-malloc.cindex 8ad6168..3bffae1 100644
---a/qemu-malloc.c
+++b/qemu-malloc.c
@@ -60,6 +60,6 @@ char *qemu_strdup(const char *str)
Quoted 7 lines
ptr = qemu_malloc(len + 1); if (!ptr) return NULL; - pstrcpy(ptr, len, str); + pstrcpy(ptr, len + 1, str); return ptr;}
Thanks, applied. I had introduced this in the patch (r5044) where I changed some strcpys to pstrcpys. Maybe the same bug got in somewhere else too.