mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 22:15:20 +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) {
|
if ((tmp = strstr(reply, MIGRATION_PREFIX)) != NULL) {
|
||||||
tmp += strlen(MIGRATION_PREFIX);
|
tmp += strlen(MIGRATION_PREFIX);
|
||||||
end = strchr(tmp, '\r');
|
end = strchr(tmp, '\r');
|
||||||
|
if (end == NULL) {
|
||||||
|
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("unexpected migration status in %s"), reply);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
|
||||||
if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
|
if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user