PackageKit/PackageKit-zypp-fix-crash-with-empty-search-string.patch
Dominique Leuenberger c18132267d Accepting request 913226 from home:JonathanKang:branches:GNOME:Factory
- Add PackageKit-zypp-fix-crash-with-empty-search-string.patch:
  zypp: Fix crash when search string is NULL (bsc#1179287,
  gh#hughsie/PackageKit/commit#21ccf49).

OBS-URL: https://build.opensuse.org/request/show/913226
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/PackageKit?expand=0&rev=421
2021-08-23 08:35:37 +00:00

31 lines
933 B
Diff

From 21ccf49464630cb9da7792d375f472c53717eecb Mon Sep 17 00:00:00 2001
From: Jonathan Kang <jonathankang@gnome.org>
Date: Thu, 12 Aug 2021 14:39:26 +0800
Subject: [PATCH] zypp: Fix crash when search string is NULL
https://bugzilla.suse.com/show_bug.cgi?id=1179287
---
backends/zypp/pk-backend-zypp.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 6da70348b..fca8ac032 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -3088,6 +3088,12 @@ backend_find_packages_thread (PkBackendJob *job, GVariant *params, gpointer user
&_filters,
&values);
+ if (values == NULL && values[0] == NULL) {
+ pk_backend_job_error_code (job, PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ "Empty search string is not supported.");
+ return;
+ }
+
ZyppJob zjob(job);
ZYpp::Ptr zypp = zjob.get_zypp();
--
2.31.1