mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemu: avoid null dereference on failed migration
* src/qemu/qemu_monitor_text.c: qemuMonitorTextGetMigrationStatus: Check for failed strchr, to silence a coverity warning.
This commit is contained in:
parent
b769339295
commit
bef10f9a05
@ -989,6 +989,11 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
||||
if ((tmp = strstr(reply, MIGRATION_PREFIX)) != NULL) {
|
||||
tmp += strlen(MIGRATION_PREFIX);
|
||||
end = strchr(tmp, '\r');
|
||||
if (end == NULL) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
*end = '\0';
|
||||
|
||||
if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user