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;