diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45ae7cf8c9..8c222d733e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2951,7 +2951,7 @@ qemuNetworkDriveGetPort(int protocol, int ret = 0; if (port) { - if (virStrToLong_i(port, NULL, 10, &ret) < 0) { + if (virStrToLong_i(port, NULL, 10, &ret) < 0 || ret < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse port number '%s'"), port);