File CVE-2019-10167-api-disallow-virConnectGetDomainCapabilities.patch of Package libvirt.16761

From 7bfe7fc810ee84ca1cef996981789445929fdb7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 14 Jun 2019 10:37:33 +0200
Subject: [PATCH 3/4] api: disallow virConnectGetDomainCapabilities on
 read-only connections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This API can be used to execute arbitrary emulators.
Forbid it on read-only connections.

Fixes: CVE-2019-10167
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/libvirt-domain.c | 1 +
 1 file changed, 1 insertion(+)

Index: libvirt-5.1.0/src/libvirt-domain.c
===================================================================
--- libvirt-5.1.0.orig/src/libvirt-domain.c
+++ libvirt-5.1.0/src/libvirt-domain.c
@@ -11362,6 +11362,7 @@ virConnectGetDomainCapabilities(virConne
     virResetLastError();
 
     virCheckConnectReturn(conn, NULL);
+    virCheckReadOnlyGoto(conn->flags, error);
 
     if (conn->driver->connectGetDomainCapabilities) {
         char *ret;
openSUSE Build Service is sponsored by