[packages/libvirt-cim] - added inline patch (remove bogus inline specifiers from prototypes without implementation accessib

qboosh qboosh at pld-linux.org
Thu Mar 19 06:19:18 CET 2020


commit 3aef243788ca94a2899480b1288669d5f65feb01
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Mar 19 06:20:21 2020 +0100

    - added inline patch (remove bogus inline specifiers from prototypes without implementation accessible)
    - added scanf patch (update auto-allocation modifiers from a to m), BR: glibc 2.7+
    - added strcpy (ensure NULL termination in some strncpys)
    - release 2 (libconfig soname change)

 libvirt-cim-inline.patch |  36 ++++++++++++++
 libvirt-cim-scanf.patch  | 123 +++++++++++++++++++++++++++++++++++++++++++++++
 libvirt-cim-strcpy.patch |  45 +++++++++++++++++
 libvirt-cim.spec         |  10 +++-
 4 files changed, 213 insertions(+), 1 deletion(-)
---
diff --git a/libvirt-cim.spec b/libvirt-cim.spec
index df17ad0..135398c 100644
--- a/libvirt-cim.spec
+++ b/libvirt-cim.spec
@@ -2,14 +2,19 @@ Summary:	CIM provider for libvirt
 Summary(pl.UTF-8):	Dostarczyciel CIM dla libvirt
 Name:		libvirt-cim
 Version:	0.6.3
-Release:	1
+Release:	2
 License:	LGPL v2.1+
 Group:		Libraries
 Source0:	ftp://libvirt.org/libvirt-cim/%{name}-%{version}.tar.bz2
 # Source0-md5:	6e5bea3a8bf9d3fca70b67498126f2e4
+Patch0:		%{name}-inline.patch
+Patch1:		%{name}-scanf.patch
+Patch2:		%{name}-strcpy.patch
 URL:		http://libvirt.org/CIM/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake
+# scanf 'm' modifier for %s-like formats
+BuildRequires:	glibc-devel >= 6:2.7
 BuildRequires:	libcmpiutil-devel >= 0.1
 BuildRequires:	libconfig-devel
 BuildRequires:	libtool
@@ -38,6 +43,9 @@ wieloma platformamy poprzez pojedynczego dostarczyciela.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 %{__libtoolize}
diff --git a/libvirt-cim-inline.patch b/libvirt-cim-inline.patch
new file mode 100644
index 0000000..70f57b2
--- /dev/null
+++ b/libvirt-cim-inline.patch
@@ -0,0 +1,36 @@
+--- libvirt-cim-0.6.3/libxkutil/list_util.h.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/libxkutil/list_util.h	2020-03-18 21:38:08.533304474 +0100
+@@ -49,22 +49,22 @@
+ 
+ bool list_foreach(list_t *list, list_foreach_cb cb, void *user_data);
+ 
+-inline unsigned int list_count(list_t *list);
++unsigned int list_count(list_t *list);
+ 
+-inline void *list_node_data_get(list_node_t *node);
+-inline void  list_node_data_set(list_node_t *node, void *data);
++void *list_node_data_get(list_node_t *node);
++void  list_node_data_set(list_node_t *node, void *data);
+ 
+-inline void        *list_first(list_t *list);
+-inline list_node_t *list_first_node(list_t *list);
++void        *list_first(list_t *list);
++list_node_t *list_first_node(list_t *list);
+ 
+-inline void        *list_last(list_t *list);
+-inline list_node_t *list_last_node(list_t *list);
++void        *list_last(list_t *list);
++list_node_t *list_last_node(list_t *list);
+ 
+-inline void        *list_node_next(list_node_t *node);
+-inline list_node_t *list_node_next_node(list_node_t *node);
++void        *list_node_next(list_node_t *node);
++list_node_t *list_node_next_node(list_node_t *node);
+ 
+-inline void        *list_node_prev(list_node_t *node);
+-inline list_node_t *list_node_prev_node(list_node_t *node);
++void        *list_node_prev(list_node_t *node);
++list_node_t *list_node_prev_node(list_node_t *node);
+ 
+ #ifdef __cplusplus
+ } /* extern "C" */
diff --git a/libvirt-cim-scanf.patch b/libvirt-cim-scanf.patch
new file mode 100644
index 0000000..c4a09f8
--- /dev/null
+++ b/libvirt-cim-scanf.patch
@@ -0,0 +1,123 @@
+--- libvirt-cim-0.6.3/libxkutil/misc_util.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/libxkutil/misc_util.c	2020-03-18 21:41:56.935179415 +0100
+@@ -671,7 +671,7 @@
+         char *tmp_pfx = NULL;
+         char *tmp_name = NULL;
+ 
+-        ret = sscanf(id, "%a[^:]:%a[^\n]", &tmp_pfx, &tmp_name);
++        ret = sscanf(id, "%m[^:]:%m[^\n]", &tmp_pfx, &tmp_name);
+         if (ret != 2) {
+                 ret = 0;
+                 goto out;
+--- libvirt-cim-0.6.3/libxkutil/device_parsing.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/libxkutil/device_parsing.c	2020-03-18 21:42:55.131536509 +0100
+@@ -1062,7 +1062,7 @@
+ {
+         int ret;
+ 
+-        ret = sscanf(devid, "%a[^/]/%a[^\n]", host, device);
++        ret = sscanf(devid, "%m[^/]/%m[^\n]", host, device);
+         if (ret != 2) {
+                 free(*host);
+                 free(*device);
+--- libvirt-cim-0.6.3/libxkutil/acl_parsing.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/libxkutil/acl_parsing.c	2020-03-18 21:43:20.709532155 +0100
+@@ -666,7 +666,7 @@
+ 
+         if ((filter == NULL) || (index == NULL))
+                 return 0;
+-        ret = sscanf(rule_id, "%as[^:]:%u", filter, index);
++        ret = sscanf(rule_id, "%ms[^:]:%u", filter, index);
+         if (ret != 2) {
+                 free(*filter);
+                 *filter = NULL;
+--- libvirt-cim-0.6.3/src/Virt_Device.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/src/Virt_Device.c	2020-03-18 22:14:20.195872698 +0100
+@@ -661,7 +661,7 @@
+ {
+         int ret;
+ 
+-        ret = sscanf(devid, "%a[^/]/%as", dom, dev);
++        ret = sscanf(devid, "%m[^/]/%ms", dom, dev);
+         if (ret != 2) {
+                 free(*dom);
+                 free(*dev);
+--- libvirt-cim-0.6.3/src/Virt_DevicePool.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/src/Virt_DevicePool.c	2020-03-18 22:14:46.990601491 +0100
+@@ -405,7 +405,7 @@
+ {
+         int ret;
+ 
+-        ret = sscanf(line, "%as %as", &pool->tag, &pool->path);
++        ret = sscanf(line, "%ms %ms", &pool->tag, &pool->path);
+         if (ret != 2) {
+                 free(pool->tag);
+                 free(pool->path);
+@@ -1610,7 +1610,7 @@
+                 goto out;
+         }
+ 
+-        ret = sscanf(id, "%*[^/]/%a[^\n]", &poolid);
++        ret = sscanf(id, "%*[^/]/%m[^\n]", &poolid);
+         if (ret != 1) {
+                 cu_statusf(broker, &s,
+                            CMPI_RC_ERR_NOT_FOUND,
+--- libvirt-cim-0.6.3/src/Virt_ComputerSystemIndication.c.orig	2013-07-25 08:50:03.000000000 +0200
++++ libvirt-cim-0.6.3/src/Virt_ComputerSystemIndication.c	2020-03-19 06:06:35.230465605 +0100
+@@ -382,7 +382,7 @@
+                 goto out;
+         }
+ 
+-        rc = sscanf(tmp, "<name>%a[^<]s</name>", &name);
++        rc = sscanf(tmp, "<name>%m[^<]s</name>", &name);
+         if (rc != 1) {
+                 name = NULL;
+         }
+--- libvirt-cim-0.6.3/src/Virt_VirtualSystemManagementService.c.orig	2013-07-25 09:30:35.000000000 +0200
++++ libvirt-cim-0.6.3/src/Virt_VirtualSystemManagementService.c	2020-03-19 06:07:23.959651833 +0100
+@@ -1239,7 +1239,7 @@
+ 
+         CU_DEBUG("Entering parse_console_address, address is %s", id);
+ 
+-        ret = sscanf(id, "%a[^:]:%as", &tmp_path, &tmp_port);
++        ret = sscanf(id, "%m[^:]:%ms", &tmp_path, &tmp_port);
+ 
+         if (ret != 2) {
+                 ret = 0;
+@@ -1275,10 +1275,10 @@
+ 
+         CU_DEBUG("Entering parse_sdl_address, address is %s", id);
+ 
+-        ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display);
++        ret = sscanf(id, "%m[^:]:%ms", &tmp_xauth, &tmp_display);
+ 
+         if (ret <= 0) {
+-                ret = sscanf(id, ":%as", &tmp_display);
++                ret = sscanf(id, ":%ms", &tmp_display);
+                 if (ret <= 0) {
+                         if (STREQC(id, ":")) {
+                                 /* do nothing, it is empty */
+@@ -1326,10 +1326,10 @@
+         CU_DEBUG("Entering parse_vnc_address, address is %s", id);
+         if (strstr(id, "[") != NULL) {
+                 /* its an ipv6 address */
+-                ret = sscanf(id, "%a[^]]]:%as",  &tmp_ip, &tmp_port);
++                ret = sscanf(id, "%m[^]]]:%ms",  &tmp_ip, &tmp_port);
+                 strcat(tmp_ip, "]");
+         } else {
+-                ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port);
++                ret = sscanf(id, "%m[^:]:%ms", &tmp_ip, &tmp_port);
+         }
+ 
+         if (ret != 2) {
+--- libvirt-cim-0.6.3/src/Virt_SettingsDefineState.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/src/Virt_SettingsDefineState.c	2020-03-19 06:08:48.530691279 +0100
+@@ -298,7 +298,7 @@
+                 goto out;
+         }
+ 
+-        ret = sscanf(id, "%a[^:]:%as", &pfx, &name);
++        ret = sscanf(id, "%m[^:]:%ms", &pfx, &name);
+         if (ret != 2) {
+                 cu_statusf(_BROKER, &s,
+                            CMPI_RC_ERR_FAILED,
diff --git a/libvirt-cim-strcpy.patch b/libvirt-cim-strcpy.patch
new file mode 100644
index 0000000..39ee9ea
--- /dev/null
+++ b/libvirt-cim-strcpy.patch
@@ -0,0 +1,45 @@
+--- libvirt-cim-0.6.3/src/Virt_HostSystem.c.orig	2013-07-25 08:39:32.000000000 +0200
++++ libvirt-cim-0.6.3/src/Virt_HostSystem.c	2020-03-18 22:13:37.787004348 +0100
+@@ -52,7 +52,8 @@
+         for (i = 0; he->h_aliases[i] != NULL; i++) {
+                if ((strchr(he->h_aliases[i], '.') != NULL) &&
+                    (strstr(he->h_aliases[i], "localhost") == NULL)) {
+-                           strncpy(buf, he->h_aliases[i], size);
++                           strncpy(buf, he->h_aliases[i], size-1);
++                           buf[size-1] = 0;
+                            return 0;
+                    }
+         }
+@@ -63,12 +64,14 @@
+         //          but also be sure the value isn't empty and that it doesn't
+         //          contain "localhost"
+         if ((he->h_name != NULL) && (!STREQC(he->h_name, "")) && 
+-            (strstr(he->h_name, "localhost") == NULL))
+-                strncpy(buf, he->h_name, size);
+-        else if ((host != NULL) && (!STREQC(host, "")) && 
+-                 (strstr(host, "localhost") == NULL))
++            (strstr(he->h_name, "localhost") == NULL)) {
++                strncpy(buf, he->h_name, size-1);
++                buf[size-1] = 0;
++	} else if ((host != NULL) && (!STREQC(host, "")) && 
++                 (strstr(host, "localhost") == NULL)) {
+                 strncpy(buf, host, size);
+-        else {
++                buf[size-1] = 0;
++	} else {
+                 CU_DEBUG("Unable to find valid hostname value.");
+                 return -1;
+         }
+@@ -86,9 +89,10 @@
+                 return -1;
+         }
+ 
+-        if (strchr(host, '.') != NULL)
++        if (strchr(host, '.') != NULL) {
+                 strncpy(buf, host, size);
+-        else
++                buf[size-1] = 0;
++	} else
+                 ret = resolve_host(host, buf, size);
+ 
+         return ret;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libvirt-cim.git/commitdiff/3aef243788ca94a2899480b1288669d5f65feb01



More information about the pld-cvs-commit mailing list