]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_process: Fix theoretical overflow in uint to bool typecast
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 9 Feb 2022 08:31:54 +0000 (09:31 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 9 Feb 2022 08:31:54 +0000 (09:31 +0100)
commitda393034c947192f51ed9a0693cf191b5cf04629
tree627b594c40bae3fcfa534e5ff9b82d647f533815
parent1b636593c76f443169ef7bdb3644fd670379d04e
qemu_process: Fix theoretical overflow in uint to bool typecast

The qemuPrepareNVRAM() function accepts three arguments and the
last one being a boolean type. However, when the function is
called from qemuProcessPrepareHost() the argument passed is a
result of logical and of @flags (unsigned int) and
VIR_QEMU_PROCESS_START_RESET_NVRAM value. In theory this is
unsafe to do because if the value of the flag is ever changed
then this expression might overflow. Do what we do elsewhere:
double negation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_process.c