From bb3fb3e120c9ecef383e86e6ac3b915aa5dd84b9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 24 2020 18:27:34 +0000 Subject: import librepo-1.12.0-2.el8 --- diff --git a/SOURCES/0001-Validate-path-read-from-repomd.xml-RhBug-1866498.patch b/SOURCES/0001-Validate-path-read-from-repomd.xml-RhBug-1866498.patch new file mode 100644 index 0000000..aeb2858 --- /dev/null +++ b/SOURCES/0001-Validate-path-read-from-repomd.xml-RhBug-1866498.patch @@ -0,0 +1,47 @@ +From 699d3ee7b8968b5586ceb53e07d678e702735609 Mon Sep 17 00:00:00 2001 +From: Jaroslav Rohel +Date: Wed, 12 Aug 2020 08:35:28 +0200 +Subject: [PATCH] Validate path read from repomd.xml + +--- + librepo/yum.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/librepo/yum.c b/librepo/yum.c +index 3059188..529257b 100644 +--- a/librepo/yum.c ++++ b/librepo/yum.c +@@ -23,6 +23,7 @@ + #define BITS_IN_BYTE 8 + + #include ++#include + #include + #include + #include +@@ -770,6 +771,22 @@ prepare_repo_download_targets(LrHandle *handle, + continue; + + char *location_href = record->location_href; ++ ++ char *dest_dir = realpath(handle->destdir, NULL); ++ path = lr_pathconcat(handle->destdir, record->location_href, NULL); ++ char *requested_dir = realpath(dirname(path), NULL); ++ lr_free(path); ++ if (!g_str_has_prefix(requested_dir, dest_dir)) { ++ g_debug("%s: Invalid path: %s", __func__, location_href); ++ g_set_error(err, LR_YUM_ERROR, LRE_IO, "Invalid path: %s", location_href); ++ g_slist_free_full(*targets, (GDestroyNotify) lr_downloadtarget_free); ++ free(requested_dir); ++ free(dest_dir); ++ return FALSE; ++ } ++ free(requested_dir); ++ free(dest_dir); ++ + gboolean is_zchunk = FALSE; + #ifdef WITH_ZCHUNK + if (handle->cachedir && record->header_checksum) +-- +2.28.0 + diff --git a/SPECS/librepo.spec b/SPECS/librepo.spec index b6d3f76..fc8c142 100644 --- a/SPECS/librepo.spec +++ b/SPECS/librepo.spec @@ -27,13 +27,15 @@ Name: librepo Version: 1.12.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Repodata downloading library License: LGPLv2+ URL: https://github.com/rpm-software-management/librepo Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Patch1: 0001-Validate-path-read-from-repomd.xml-RhBug-1866498.patch + BuildRequires: cmake BuildRequires: gcc BuildRequires: check-devel @@ -190,6 +192,9 @@ popd %endif %changelog +* Mon Aug 17 2020 Ales Matej - 1.12.0-2 +- Validate paths read from repomd.xml (RhBug:1866505) + * Wed Jun 03 2020 Nicola Sella - 1.12.0-1 - Update to 1.12.0 - Decode package URL when using for local filename (RhBug:1817130)