]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vircommand: Ensure buffers are NULL-terminated
authorAndrea Bolognani <abologna@redhat.com>
Tue, 5 Feb 2019 13:30:42 +0000 (14:30 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 19 Feb 2019 14:58:59 +0000 (15:58 +0100)
commit1d2a62b2e0f41f82b92b7d5903fcb67bdf23800d
treeca04b86f9656932bb1ed61c0dff28f21c98398b4
parent0b856db8ab7f2fafcace36348d11cd9fae4b8a2d
vircommand: Ensure buffers are NULL-terminated

The memory allocated by VIR_REALLOC_N() is uninitialized,
which means it's not possible to figure out whether any
output was produced at all after the fact.

Since we don't care about the previous contents of buffers,
if any, use VIR_FREE() followed by VIR_ALLOC_N() instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/util/vircommand.c