[reporter-bugzilla] Fix subcomponent handling

Resolves: rhbz#2037399

Signed-off-by: Michal Srb <michal@redhat.com>
This commit is contained in:
Michal Srb 2021-09-07 14:58:49 +02:00
parent 8fa03e1482
commit fe1b2aa550
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From 50fdc7f23f35744ffff1763fe2d804b18c1c5340 Mon Sep 17 00:00:00 2001
From: Michal Srb <michal@redhat.com>
Date: Tue, 7 Sep 2021 14:40:21 +0200
Subject: [PATCH] [rhbz] Be a little bit more defensive when working with
subcomponents
Components in RHEL can have "subcomponents" in Bugzilla. Some of them
have, some of them don't. Better be careful.
See: rhbz#1998435
Signed-off-by: Michal Srb <michal@redhat.com>
---
src/plugins/rhbz.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index c2855a70..0dae1e93 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -1036,13 +1036,17 @@ char *rhbz_get_default_sub_component(const char *component, xmlrpc_value *sub_co
}
else
{
- xmlrpc_array_read_item(&env, sub_components, sc_array_size - 1, &sc_struct);
- xmlrpc_struct_find_value(&env, sc_struct, "name", &sc_name);
- xmlrpc_read_string(&env, sc_name, &sc_str_name);
- if (sc_struct)
- xmlrpc_DECREF(sc_struct);
- if (sc_name)
- xmlrpc_DECREF(sc_name);
+ if (sc_array_size) {
+ xmlrpc_array_read_item(&env, sub_components, sc_array_size - 1, &sc_struct);
+ if (xmlrpc_struct_has_key(&env, sc_struct, "name")) {
+ xmlrpc_struct_find_value(&env, sc_struct, "name", &sc_name);
+ xmlrpc_read_string(&env, sc_name, &sc_str_name);
+ }
+ if (sc_struct)
+ xmlrpc_DECREF(sc_struct);
+ if (sc_name)
+ xmlrpc_DECREF(sc_name);
+ }
}
return (char *)sc_str_name;
--
2.31.1

View File

@ -15,11 +15,12 @@
Summary: Generic library for reporting various problems
Name: libreport
Version: 2.15.2
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
URL: https://abrt.readthedocs.org/
Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-Change-the-default-Bugzilla-group.patch
Patch2: 0002-rhbz-Be-a-little-bit-more-defensive-when-working-wit.patch
BuildRequires: %{dbus_devel}
BuildRequires: gtk3-devel
BuildRequires: curl-devel
@ -653,6 +654,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif
%changelog
* Mon Jan 17 2022 Michal Srb <michal@redhat.com> - 2.15.2-5
- [reporter-bugzilla] Fix subcomponent handling
- Related: rhbz#2037399
* Mon Jan 17 2022 Michal Srb <michal@redhat.com> - 2.15.2-4
- Change the default Bugzilla group
- Resolves: rhbz#2037399