summary refs log tree commit diff stats
path: root/qapi/qapi-util.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-11-03 11:52:57 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2020-11-03 09:42:54 -0500
commit0250edf1eb4ff0b164c0cdabcbf4313507f3082e (patch)
tree7ec5f3bce386099613cdd8ba1f9b8ae3d7d50f22 /qapi/qapi-util.c
parent1d72d9c4874f61c38df9a473e2fd4de869ba0b11 (diff)
downloadfocaccia-qemu-0250edf1eb4ff0b164c0cdabcbf4313507f3082e.tar.gz
focaccia-qemu-0250edf1eb4ff0b164c0cdabcbf4313507f3082e.zip
tests/qtest/libqos/ahci.c: Avoid NULL dereference in ahci_exec()
In ahci_exec() we attempt to permit the caller to pass a NULL pointer
for opts_in (in which case we use a default set of options).  However
although we check for NULL when setting up the opts variable at the
top of the function, we unconditionally dereference opts_in at the
end of the function as part of freeing the opts->buffer.

Switch to checking whether the final buffer is the same as the
buffer we started with, instead of assuming the value we started
with is always opts_in->buffer.

At the moment all the callers pass a non-NULL opts argument, so
we never saw any crashes in practice.

Fixes: Coverity CID 1432302
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201103115257.23623-1-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qapi/qapi-util.c')
0 files changed, 0 insertions, 0 deletions