* [Qemu-devel] [PATCH] qemu_strdup() doesn't copy alast character
@ 2008-08-25 9:22 Gleb Natapov
2008-08-25 20:05 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Gleb Natapov @ 2008-08-25 9:22 UTC (permalink / raw)
To: qemu-devel
Because of off by one error.
Signed-off-by: Gleb Natapov <gleb@qumranet.com>
diff --git a/qemu-malloc.c b/qemu-malloc.c
index 8ad6168..3bffae1 100644
--- a/qemu-malloc.c
+++ b/qemu-malloc.c
@@ -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.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu_strdup() doesn't copy alast character
2008-08-25 9:22 [Qemu-devel] [PATCH] qemu_strdup() doesn't copy alast character Gleb Natapov
@ 2008-08-25 20:05 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2008-08-25 20:05 UTC (permalink / raw)
To: qemu-devel
On 8/25/08, Gleb Natapov <gleb@qumranet.com> wrote:
>
> Because of off by one error.
>
>
> Signed-off-by: Gleb Natapov <gleb@qumranet.com>
>
> diff --git a/qemu-malloc.c b/qemu-malloc.c
> index 8ad6168..3bffae1 100644
> --- a/qemu-malloc.c
> +++ b/qemu-malloc.c
> @@ -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;
> }
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-25 20:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-25 9:22 [Qemu-devel] [PATCH] qemu_strdup() doesn't copy alast character Gleb Natapov
2008-08-25 20:05 ` Blue Swirl
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).