Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2457ff7037 | |||
| d8ce9b00e6 | |||
| 5238691972 | |||
| 49bd0fe0f6 | |||
| f57c13f43b | |||
| b4531a6202 | |||
| 0685aa3535 |
+24
@@ -0,0 +1,24 @@
|
||||
libvirt-0.0.3.tar.gz
|
||||
libvirt-0.0.4.tar.gz
|
||||
libvirt-0.0.5.tar.gz
|
||||
libvirt-0.0.6.tar.gz
|
||||
libvirt-0.1.0.tar.gz
|
||||
libvirt-0.1.2.tar.gz
|
||||
libvirt-0.1.1.tar.gz
|
||||
libvirt-0.1.3.tar.gz
|
||||
libvirt-0.1.4.tar.gz
|
||||
libvirt-0.1.5.tar.gz
|
||||
libvirt-0.1.6.tar.gz
|
||||
libvirt-0.1.7.tar.gz
|
||||
libvirt-0.1.8.tar.gz
|
||||
libvirt-0.1.9.tar.gz
|
||||
libvirt-0.1.10.tar.gz
|
||||
libvirt-0.1.11.tar.gz
|
||||
libvirt-0.2.0.tar.gz
|
||||
libvirt-0.2.1.tar.gz
|
||||
libvirt-0.2.2.tar.gz
|
||||
libvirt-0.2.3.tar.gz
|
||||
libvirt-0.3.0.tar.gz
|
||||
libvirt-0.3.1.tar.gz
|
||||
libvirt-0.3.2.tar.gz
|
||||
libvirt-0.3.3.tar.gz
|
||||
@@ -1,5 +0,0 @@
|
||||
.build*.log
|
||||
*.rpm
|
||||
i686
|
||||
x86_64
|
||||
libvirt-*.tar.gz
|
||||
@@ -4,7 +4,7 @@ NAME := libvirt
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
Avoid segfault upon early libvirtd failure.
|
||||
* qemud/qemud.c (main): Don't call qemudCleanup on an
|
||||
uninitialized pointer.
|
||||
|
||||
By the way, even though this evoked a warning from gcc,
|
||||
"make distcheck" passes. Obviously, that means the distcheck
|
||||
rule is inadequate. I'll fix it so that it turns on -Werror
|
||||
for the final build.
|
||||
|
||||
Signed-off-by: Jim Meyering <meyering@redhat.com>
|
||||
---
|
||||
qemud/qemud.c | 5 +++--
|
||||
1 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/qemud/qemud.c b/qemud/qemud.c
|
||||
index 96fdf32..b6b82ed 100644
|
||||
--- a/qemud/qemud.c
|
||||
+++ b/qemud/qemud.c
|
||||
@@ -2025,7 +2025,7 @@ libvirt management daemon:\n\
|
||||
|
||||
#define MAX_LISTEN 5
|
||||
int main(int argc, char **argv) {
|
||||
- struct qemud_server *server;
|
||||
+ struct qemud_server *server = NULL;
|
||||
struct sigaction sig_action;
|
||||
int sigpipe[2];
|
||||
const char *pid_file = NULL;
|
||||
@@ -2180,7 +2180,8 @@ int main(int argc, char **argv) {
|
||||
unlink (pid_file);
|
||||
|
||||
error1:
|
||||
- qemudCleanup(server);
|
||||
+ if (server)
|
||||
+ qemudCleanup(server);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
Don't use first byte of string as a pointer.
|
||||
* src/qemu_conf.c (qemudReportError): Use the pointer, errorMessage,
|
||||
not its first byte, errorMessage[0].
|
||||
|
||||
Signed-off-by: Jim Meyering <meyering@redhat.com>
|
||||
---
|
||||
src/qemu_conf.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
|
||||
index eead0bc..e54da5b 100644
|
||||
--- a/src/qemu_conf.c
|
||||
+++ b/src/qemu_conf.c
|
||||
@@ -68,7 +68,7 @@ void qemudReportError(virConnectPtr conn,
|
||||
errorMessage[0] = '\0';
|
||||
}
|
||||
|
||||
- virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage[0] : NULL));
|
||||
+ virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage : NULL));
|
||||
__virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
|
||||
virerr, errorMessage, NULL, -1, -1, virerr, errorMessage);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
From 452bf160e5bbe0789d706fda95f5919551eb2cac Mon Sep 17 00:00:00 2001
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 25 Mar 2011 16:45:45 +0100
|
||||
Subject: [PATCH 2/2] daemon: Avoid resetting errors before they are reported
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=690733
|
||||
|
||||
Commit f44bfb7 was supposed to make sure no additional libvirt API (esp.
|
||||
*Free) is called before remoteDispatchConnError() is called on error.
|
||||
However, the patch missed two instances.
|
||||
(cherry picked from commit 55cc591fc18e87b29febf78dc5b424b7c12f7349)
|
||||
---
|
||||
daemon/remote.c | 6 ++++--
|
||||
1 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index a8258ca..7464957 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -4547,12 +4547,13 @@ remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUS
|
||||
ret->names.names_len =
|
||||
virStoragePoolListVolumes (pool,
|
||||
ret->names.names_val, args->maxnames);
|
||||
- virStoragePoolFree(pool);
|
||||
if (ret->names.names_len == -1) {
|
||||
VIR_FREE(ret->names.names_val);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
+ virStoragePoolFree(pool);
|
||||
return -1;
|
||||
}
|
||||
+ virStoragePoolFree(pool);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4576,11 +4577,12 @@ remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNU
|
||||
}
|
||||
|
||||
ret->num = virStoragePoolNumOfVolumes (pool);
|
||||
- virStoragePoolFree(pool);
|
||||
if (ret->num == -1) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
+ virStoragePoolFree(pool);
|
||||
return -1;
|
||||
}
|
||||
+ virStoragePoolFree(pool);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
diff -rup libvirt-0.8.3.orig/src/qemu/qemu_conf.c libvirt-0.8.3.new/src/qemu/qemu_conf.c
|
||||
--- libvirt-0.8.3.orig/src/qemu/qemu_conf.c 2010-08-04 13:21:27.000000000 +0100
|
||||
+++ libvirt-0.8.3.new/src/qemu/qemu_conf.c 2010-08-23 21:08:13.239794362 +0100
|
||||
@@ -3651,7 +3651,7 @@ int qemudBuildCommandLine(virConnectPtr
|
||||
{
|
||||
int i;
|
||||
char memory[50];
|
||||
- char boot[VIR_DOMAIN_BOOT_LAST];
|
||||
+ char boot[VIR_DOMAIN_BOOT_LAST+1];
|
||||
struct utsname ut;
|
||||
int disableKQEMU = 0;
|
||||
int disableKVM = 0;
|
||||
@@ -1,44 +0,0 @@
|
||||
From f970d802ab805f1a37af384f148f34e108714034 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 3 Nov 2010 15:20:24 -0600
|
||||
Subject: [PATCH] rpm: fix /var/lib/libvirt permissions
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=649511
|
||||
|
||||
Regression of forcing 0700 permissions (which breaks guest startup
|
||||
because the qemu user can't see /var/lib/libvirt/*.monitor) was
|
||||
introduced in commit 66823690e, as part of libvirt 0.8.2.
|
||||
|
||||
* libvirt.spec.in (%files): Drop %{_localstatedir}/lib/libvirt,
|
||||
since libvirt depends on libvirt-client.
|
||||
(%files client): Guarantee 755 permissions on
|
||||
%(_localstatedir}/lib/libvirt, since the qemu user must be able to
|
||||
do pathname resolution to a subdirectory.
|
||||
---
|
||||
libvirt.spec.in | 3 +--
|
||||
1 files changed, 1 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index 813e0c0..f77626e 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -793,7 +793,6 @@ fi
|
||||
|
||||
%dir %{_localstatedir}/run/libvirt/
|
||||
|
||||
-%dir %{_localstatedir}/lib/libvirt/
|
||||
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
|
||||
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
|
||||
%dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/
|
||||
@@ -883,7 +882,7 @@ fi
|
||||
|
||||
%{_sysconfdir}/rc.d/init.d/libvirt-guests
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests
|
||||
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt
|
||||
+%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/
|
||||
|
||||
%if %{with_sasl}
|
||||
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 8efebd1761700a0cc32736829aead7807cc7865d Mon Sep 17 00:00:00 2001
|
||||
From: =?utf8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@gmail.com>
|
||||
Date: Tue, 26 Oct 2010 14:45:03 +0200
|
||||
Subject: [PATCH] qemu: don't use %.3d format for bus/addr of USB devices
|
||||
|
||||
When using 0-prefixed numbers, QEmu will interpret them as octal numbers
|
||||
(as C convention says); this means that if you attach a device that has
|
||||
addr > 10 (decimal) you're going to attach a different device.
|
||||
---
|
||||
src/qemu/qemu_conf.c | 4 ++--
|
||||
.../qemuxml2argv-hostdev-usb-address-device.args | 2 +-
|
||||
.../qemuxml2argv-hostdev-usb-address.args | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 00e89a1..5bd3d4c 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -3266,7 +3266,7 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (virAsprintf(&ret, "usb-host,hostbus=%.3d,hostaddr=%.3d,id=%s",
|
||||
+ if (virAsprintf(&ret, "usb-host,hostbus=%d,hostaddr=%d,id=%s",
|
||||
dev->source.subsys.u.usb.bus,
|
||||
dev->source.subsys.u.usb.device,
|
||||
dev->info.alias) < 0)
|
||||
@@ -3288,7 +3288,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (virAsprintf(&ret, "host:%.3d.%.3d",
|
||||
+ if (virAsprintf(&ret, "host:%d.%d",
|
||||
dev->source.subsys.u.usb.bus,
|
||||
dev->source.subsys.u.usb.device) < 0)
|
||||
virReportOOMError();
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
|
||||
index 6900fd3..7e42542 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
|
||||
@@ -1 +1 @@
|
||||
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device usb-host,hostbus=014,hostaddr=006,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device usb-host,hostbus=14,hostaddr=6,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
|
||||
index e57bec1..96e004d 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
|
||||
@@ -1 +1 @@
|
||||
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:014.006
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:14.6
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
From: Guido Günther <agx@sigxcpu.org>
|
||||
Date: Mon, 14 Mar 2011 02:56:28 +0000 (+0800)
|
||||
Subject: Add missing checks for read only connections
|
||||
X-Git-Url: http://libvirt.org/git/?p=libvirt.git;a=commitdiff_plain;h=71753cb7f7a16ff800381c0b5ee4e99eea92fed3;hp=13c00dde3171b3a38d23cceb3f9151cb6cac3dad
|
||||
|
||||
Add missing checks for read only connections
|
||||
|
||||
As pointed on CVE-2011-1146, some API forgot to check the read-only
|
||||
status of the connection for entry point which modify the state
|
||||
of the system or may lead to a remote execution using user data.
|
||||
The entry points concerned are:
|
||||
- virConnectDomainXMLToNative
|
||||
- virNodeDeviceDettach
|
||||
- virNodeDeviceReAttach
|
||||
- virNodeDeviceReset
|
||||
- virDomainRevertToSnapshot
|
||||
- virDomainSnapshotDelete
|
||||
|
||||
* src/libvirt.c: fix the above set of entry points to error on read-only
|
||||
connections
|
||||
|
||||
Rebased to 0.8.2, mostly changed the call of the error routines
|
||||
---
|
||||
|
||||
--- src/libvirt.c.orig 2011-03-14 17:03:45.000000000 +0800
|
||||
+++ src/libvirt.c 2011-03-14 17:10:41.000000000 +0800
|
||||
@@ -3190,6 +3190,10 @@ char *virConnectDomainXMLToNative(virCon
|
||||
virDispatchError(NULL);
|
||||
return (NULL);
|
||||
}
|
||||
+ if (conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(NULL, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (nativeFormat == NULL || domainXml == NULL) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
@@ -9432,6 +9436,11 @@ virNodeDeviceDettach(virNodeDevicePtr de
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ if (dev->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (dev->conn->driver->nodeDeviceDettach) {
|
||||
int ret;
|
||||
ret = dev->conn->driver->nodeDeviceDettach (dev);
|
||||
@@ -9475,6 +9484,11 @@ virNodeDeviceReAttach(virNodeDevicePtr d
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ if (dev->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (dev->conn->driver->nodeDeviceReAttach) {
|
||||
int ret;
|
||||
ret = dev->conn->driver->nodeDeviceReAttach (dev);
|
||||
@@ -9520,6 +9534,11 @@ virNodeDeviceReset(virNodeDevicePtr dev)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ if (dev->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (dev->conn->driver->nodeDeviceReset) {
|
||||
int ret;
|
||||
ret = dev->conn->driver->nodeDeviceReset (dev);
|
||||
@@ -12775,6 +12794,10 @@ virDomainRevertToSnapshot(virDomainSnaps
|
||||
}
|
||||
|
||||
conn = snapshot->domain->conn;
|
||||
+ if (conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (conn->driver->domainRevertToSnapshot) {
|
||||
int ret = conn->driver->domainRevertToSnapshot(snapshot, flags);
|
||||
@@ -12821,6 +12844,10 @@ virDomainSnapshotDelete(virDomainSnapsho
|
||||
}
|
||||
|
||||
conn = snapshot->domain->conn;
|
||||
+ if (conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (conn->driver->domainSnapshotDelete) {
|
||||
int ret = conn->driver->domainSnapshotDelete(snapshot, flags);
|
||||
@@ -1,106 +0,0 @@
|
||||
From 584f9cee6926b57a19cc8bb36ea77124bdcfed94 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Fri, 24 Jun 2011 12:16:05 -0600
|
||||
Subject: [PATCH] remote: protect against integer overflow
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=717204
|
||||
CVE-2011-2511 - integer overflow in VirDomainGetVcpus
|
||||
|
||||
Integer overflow and remote code are never a nice mix.
|
||||
|
||||
This has existed since commit 56cd414.
|
||||
|
||||
* src/libvirt.c (virDomainGetVcpus): Reject overflow up front.
|
||||
* src/remote/remote_driver.c (remoteDomainGetVcpus): Avoid overflow
|
||||
on sending rpc.
|
||||
* daemon/remote.c (remoteDispatchDomainGetVcpus): Avoid overflow on
|
||||
receiving rpc.
|
||||
|
||||
(cherry picked from commit 774b21c163845170c9ffa873f5720d318812eaf6)
|
||||
|
||||
Conflicts:
|
||||
|
||||
daemon/remote.c
|
||||
src/remote/remote_driver.c
|
||||
src/libvirt.c
|
||||
|
||||
Change to internal.h required to avoid backporting 89d994ad.
|
||||
---
|
||||
daemon/remote.c | 3 ++-
|
||||
src/internal.h | 17 +++++++++++++++++
|
||||
src/libvirt.c | 4 ++--
|
||||
src/remote/remote_driver.c | 3 ++-
|
||||
4 files changed, 23 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index 7464957..c6f7007 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -1697,7 +1697,8 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
|
||||
+ if (INT_MULTIPLY_OVERFLOW(args->maxinfo, args->maplen) ||
|
||||
+ args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchFormatError (rerr, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
|
||||
return -1;
|
||||
diff --git a/src/internal.h b/src/internal.h
|
||||
index fab3e11..53447a9 100644
|
||||
--- a/src/internal.h
|
||||
+++ b/src/internal.h
|
||||
@@ -226,4 +226,21 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
+/* branch-specific: we don't want to update gnulib on the branch, so this
|
||||
+ * backports just one required macro from newer gnulib's intprops.h.
|
||||
+ * This version requires that both a and b are 'int', rather than
|
||||
+ * the fully type-generic version from gnulib. */
|
||||
+# define INT_MULTIPLY_OVERFLOW(a, b) \
|
||||
+ ((b) < 0 \
|
||||
+ ? ((a) < 0 \
|
||||
+ ? (a) < INT_MAX / (b) \
|
||||
+ : (b) == -1 \
|
||||
+ ? 0 \
|
||||
+ : INT_MIN / (b) < (a)) \
|
||||
+ : (b) == 0 \
|
||||
+ ? 0 \
|
||||
+ : ((a) < 0 \
|
||||
+ ? (a) < INT_MIN / (b) \
|
||||
+ : INT_MAX / (b) < (a)))
|
||||
+
|
||||
#endif /* __VIR_INTERNAL_H__ */
|
||||
diff --git a/src/libvirt.c b/src/libvirt.c
|
||||
index 1213ecf..6a584fb 100644
|
||||
--- a/src/libvirt.c
|
||||
+++ b/src/libvirt.c
|
||||
@@ -5218,8 +5218,8 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
||||
|
||||
/* Ensure that domainGetVcpus (aka remoteDomainGetVcpus) does not
|
||||
try to memcpy anything into a NULL pointer. */
|
||||
- if ((cpumaps == NULL && maplen != 0)
|
||||
- || (cpumaps && maplen <= 0)) {
|
||||
+ if (!cpumaps ? maplen != 0
|
||||
+ : (maplen <= 0 || INT_MULTIPLY_OVERFLOW(maxinfo, maplen))) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
|
||||
index cb0d8e1..0d9b425 100644
|
||||
--- a/src/remote/remote_driver.c
|
||||
+++ b/src/remote/remote_driver.c
|
||||
@@ -2467,7 +2467,8 @@ remoteDomainGetVcpus (virDomainPtr domain,
|
||||
maxinfo, REMOTE_VCPUINFO_MAX);
|
||||
goto done;
|
||||
}
|
||||
- if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
|
||||
+ if (INT_MULTIPLY_OVERFLOW(maxinfo, maplen) ||
|
||||
+ maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
|
||||
remoteError(VIR_ERR_RPC,
|
||||
_("vCPU map buffer length exceeds maximum: %d > %d"),
|
||||
maxinfo * maplen, REMOTE_CPUMAPS_MAX);
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+120
-1029
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user