diff options
author | Jindrich Novy <jnovy@redhat.com> | 2009-06-16 13:53:42 +0200 |
---|---|---|
committer | Jindrich Novy <jnovy@redhat.com> | 2009-06-16 13:53:42 +0200 |
commit | 8f44f9159cb1f522f20b88821bab38e4ee0ef565 (patch) | |
tree | 92f4ef568fdcff36f547673b6d37c1d976ebb0dd | |
parent | 71a7dd8b7a2df677214c18473eac661ea38fb649 (diff) | |
download | rpm-8f44f9159cb1f522f20b88821bab38e4ee0ef565.tar.gz rpm-8f44f9159cb1f522f20b88821bab38e4ee0ef565.tar.bz2 rpm-8f44f9159cb1f522f20b88821bab38e4ee0ef565.zip |
Don't check Provides/Requires for bad characters, they could be UTF-8
- don't check Name but EVR in parseRCPOT()
- use rpm namespacing for charCheck()
- remove unused variable
-rw-r--r-- | build/parsePreamble.c | 8 | ||||
-rw-r--r-- | build/parseReqs.c | 7 | ||||
-rw-r--r-- | build/rpmbuild.h | 2 |
3 files changed, 6 insertions, 11 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 6de05000a..af86c7972 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -454,7 +454,7 @@ extern int noLang; * @param whitelist string of permitted characters * @return RPMRC_OK if OK */ -rpmRC charCheck(rpmSpec spec, char *field, size_t fsize, const char *whitelist) +rpmRC rpmCharCheck(rpmSpec spec, char *field, size_t fsize, const char *whitelist) { char *ch, *stop = &field[fsize]; @@ -484,7 +484,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag, const char *macro, const char *lang) { char * field = spec->line; - char * end, *ch; + char * end; int multiToken = 0; rpmsenseFlags tagflags; int rc; @@ -519,13 +519,13 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag, switch (tag) { case RPMTAG_NAME: SINGLE_TOKEN_ONLY; - if (charCheck(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 (charCheck(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 48e469e24..e2377964b 100644 --- a/build/parseReqs.c +++ b/build/parseReqs.c @@ -114,11 +114,6 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN, N = xmalloc((re-r) + 1); rstrlcpy(N, r, (re-r) + 1); - /* Check for weird characters in Requires/Provides, etc.*/ - if (r[0] != '/') { - if (charCheck(spec, N, re-r, ".-_+()")) return RPMRC_FAIL; - } - /* Parse EVR */ v = re; SKIPWHITE(v); @@ -172,7 +167,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN, } EVR = xmalloc((ve-v) + 1); rstrlcpy(EVR, v, (ve-v) + 1); - if (charCheck(spec, N, ve-v, ".-_+")) return RPMRC_FAIL; + if (rpmCharCheck(spec, EVR, ve-v, ".-_+")) return RPMRC_FAIL; re = ve; /* ==> next token after EVR string starts here */ } else EVR = NULL; diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 304dba9fe..6b3d765d8 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -243,7 +243,7 @@ int parsePrep(rpmSpec spec); * @param whitelist string of permitted characters * @return RPMRC_OK if OK */ -rpmRC charCheck(rpmSpec spec, char *field, size_t fsize, const char *whitelist); +rpmRC rpmCharCheck(rpmSpec spec, char *field, size_t fsize, const char *whitelist); /** \ingroup rpmbuild * Parse dependency relations from spec file and/or autogenerated output buffer. |