mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
Protected against potential crash scenarios
* src/qemu_driver.c: Check that monitor device is not NULL before runing a command to protect against bugs in caller
This commit is contained in:
parent
88e3e8be7c
commit
e170af3ac0
@ -2299,6 +2299,11 @@ qemudMonitorCommandExtra(const virDomainObjPtr vm,
|
||||
int size = 0;
|
||||
char *buf = NULL;
|
||||
|
||||
/* Should never happen, but just in case, protect
|
||||
* against null monitor (ocurrs when VM is inactive) */
|
||||
if (!vm->monitor_chr)
|
||||
return -1;
|
||||
|
||||
qemuMonitorDiscardPendingData(vm);
|
||||
|
||||
if (qemudMonitorSend(vm, cmd, scm_fd) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user