- permit unexpanded macros when parsing spec (#547997)

This commit is contained in:
Panu Matilainen 2009-12-17 06:54:51 +00:00
parent 36fffc974d
commit 6dc5ba3bbe
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,43 @@
commit 507f21f6bb4bf7029a0bca255cfe4aae3361f358
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Thu Dec 17 08:43:31 2009 +0200
Permit unexpanded macros to slip through spec tag sanity checks (RhBug:547997)
- For now, let %{} characters through our valid character set checks
on specs. This isn't right really, but unexpanded, unrelated macros
in spec can now cause failure to parse out buildrequires which would
allow those macros to be expanded. This needs a better fix.
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 82744fd..b5f1780 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -517,13 +517,13 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
switch (tag) {
case RPMTAG_NAME:
SINGLE_TOKEN_ONLY;
- if (rpmCharCheck(spec, field, strlen(field), ".-_+") != RPMRC_OK) return RPMRC_FAIL;
+ if (rpmCharCheck(spec, field, strlen(field), ".-_+%{}") != RPMRC_OK) return RPMRC_FAIL;
headerPutString(pkg->header, tag, field);
break;
case RPMTAG_VERSION:
case RPMTAG_RELEASE:
SINGLE_TOKEN_ONLY;
- if (rpmCharCheck(spec, field, strlen(field), "._+") != RPMRC_OK) return RPMRC_FAIL;
+ if (rpmCharCheck(spec, field, strlen(field), "._+%{}") != RPMRC_OK) return RPMRC_FAIL;
headerPutString(pkg->header, tag, field);
break;
case RPMTAG_URL:
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 1a657a6..d12aca3 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -168,7 +168,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
}
EVR = xmalloc((ve-v) + 1);
rstrlcpy(EVR, v, (ve-v) + 1);
- if (rpmCharCheck(spec, EVR, ve-v, ".-_+:")) goto exit;
+ if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}")) goto exit;
re = ve; /* ==> next token after EVR string starts here */
} else
EVR = NULL;

View File

@ -21,7 +21,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: 0.%{snapver}.3
Release: 0.%{snapver}.4
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -39,6 +39,7 @@ Patch3: rpm-4.7.90-fedora-specspo.patch
# Patches already in upstream
Patch200: rpm-4.7.90-python-bytecompile.patch
Patch201: rpm-4.7.90-python-refcounts.patch
Patch202: rpm-4.7.90-spec-allow-unexpanded-macros.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@ -185,6 +186,7 @@ packages on a system.
%patch200 -p1 -b .python-bytecompile
%patch201 -p1 -b .python-refcounts
%patch202 -p1 -b .spec-unexpanded-macros
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@ -399,6 +401,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Thu Dec 17 2009 Panu Matilainen <pmatilai@redhat.com> - 4.8.0-0.beta1.4
- permit unexpanded macros when parsing spec (#547997)
* Wed Dec 09 2009 Panu Matilainen <pmatilai@redhat.com> - 4.8.0-0.beta1.3
- fix a bunch of python refcount-errors causing major memory leaks