提交 2cad501b 编写于 作者: P Peter Krempa

qemu: monitor: Fix device matching in qemuMonitorJSONBlockIoThrottleInfo

We should compare the alias/qdev id only when it was provided by the
caller and when it was found in the reply. Otherwise we could
dereference a NULL pointer. STRNEQ_NULLABLE is not appropriate since
it would return 'true' if the string was not present in the JSON output.

Found by Coverity.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 8aced2ea
......@@ -5001,8 +5001,8 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
goto cleanup;
}
if ((drivealias && STRNEQ(current_drive, drivealias)) ||
(qdevid && STRNEQ(current_qdev, qdevid)))
if ((drivealias && current_drive && STRNEQ(current_drive, drivealias)) ||
(qdevid && current_qdev && STRNEQ(current_qdev, qdevid)))
continue;
found = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册