From 1e9ebe1f030331cbab3000169133dda53c4110ea Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Ayllon Date: Tue, 4 Aug 2020 09:12:44 +0200 Subject: [PATCH] Apply patch for NULL ptr deref in initial_state_start_fun Thanks to Steve Grubb --- libmetalink-0.1.3-ns_uri.patch | 21 +++++++++++++++++++++ libmetalink.spec | 10 ++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 libmetalink-0.1.3-ns_uri.patch diff --git a/libmetalink-0.1.3-ns_uri.patch b/libmetalink-0.1.3-ns_uri.patch new file mode 100644 index 0000000..daa5fa7 --- /dev/null +++ b/libmetalink-0.1.3-ns_uri.patch @@ -0,0 +1,21 @@ +diff -urp libmetalink-0.1.3.orig/lib/metalink_pstate.c libmetalink-0.1.3/lib/metalink_pstate.c +--- libmetalink-0.1.3.orig/lib/metalink_pstate.c 2012-08-12 04:43:53.000000000 -0400 ++++ libmetalink-0.1.3/lib/metalink_pstate.c 2020-07-22 17:03:21.205852103 -0400 +@@ -100,7 +100,7 @@ void initial_state_start_fun(metalink_ps + const char** attrs) + { + if(strcmp("metalink", name) == 0) { +- if (strcmp(METALINK_V3_NS_URI, ns_uri) == 0) { ++ if (ns_uri && strcmp(METALINK_V3_NS_URI, ns_uri) == 0) { + const char* type; + const char* origin; + metalink_pctrl_set_version(stm->ctrl, METALINK_VERSION_3); +@@ -116,7 +116,7 @@ void initial_state_start_fun(metalink_ps + + metalink_pstm_enter_metalink_state(stm); + } +- else if (strcmp(METALINK_V4_NS_URI, ns_uri) == 0) { ++ else if (ns_uri && strcmp(METALINK_V4_NS_URI, ns_uri) == 0) { + metalink_pctrl_set_version(stm->ctrl, METALINK_VERSION_4); + metalink_pstm_enter_metalink_state_v4(stm); + } else { diff --git a/libmetalink.spec b/libmetalink.spec index 00edc24..cca8b88 100644 --- a/libmetalink.spec +++ b/libmetalink.spec @@ -1,10 +1,13 @@ Name: libmetalink Version: 0.1.3 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Metalink library written in C License: MIT URL: https://launchpad.net/libmetalink Source0: https://launchpad.net/libmetalink/trunk/%{name}-%{version}/+download/%{name}-%{version}.tar.bz2 +# https://bugs.launchpad.net/libmetalink/+bug/1888672 +Patch0: libmetalink-0.1.3-ns_uri.patch + BuildRequires: gcc BuildRequires: expat-devel BuildRequires: CUnit-devel @@ -21,7 +24,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Files needed for building applications with libmetalink. %prep -%setup -q +%autosetup -p1 %build %configure --disable-static @@ -57,6 +60,9 @@ find $RPM_BUILD_ROOT -name *.la -exec rm {} \; %changelog +* Tue Aug 04 2020 Alejandro Alvarez Ayllon - 0.1.3-13 +- Apply patch fixing NULL ptr deref in initial_state_start_fun (#1860976) + * Tue Jul 28 2020 Fedora Release Engineering - 0.1.3-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild