Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
librepo.16195
validate_path.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File validate_path.patch of Package librepo.16195
From f82bdd0fa31b7da8e53c49d0afb87303612f2811 Mon Sep 17 00:00:00 2001 From: Jaroslav Rohel <jrohel@redhat.com> Date: Wed, 12 Aug 2020 08:35:28 +0200 Subject: [PATCH] Validate path read from repomd.xml (RhBug:1868639) = changelog = msg: Validate path read from repomd.xml type: security resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1868639 --- 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 <stdio.h> +#include <libgen.h> #include <assert.h> #include <stdlib.h> #include <errno.h> @@ -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)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor