[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.7] qtest.c: Allow zero size in memset qtes
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH for-2.7] qtest.c: Allow zero size in memset qtest commands |
Date: |
Thu, 8 Sep 2016 09:37:32 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 08/05/2016 05:43 AM, Peter Maydell wrote:
> Some tests use the qtest protocol "memset" command with a zero
> size, expecting it to do nothing. However in the current code this
> will result in calling memset() with a NULL pointer, which is
> undefined behaviour. Detect and specially handle zero sizes to
> avoid this.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> Looking at the code for the other commands that take a size
> ('read', 'write', 'b64read' and 'b64write' they all assume a
> non-zero size. I've left those alone though, somebody else can
> make them do nothing on zero size if they feel it's important.)
I obviously missed reviewing this in time for 2.7, but looks reasonable
to me.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature