summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>2018-01-25 20:59:02 +0100
committerPanu Matilainen <pmatilai@redhat.com>2020-03-26 11:57:58 +0200
commit7e5a3ef4250fe760c99a9caea9eed899bc84178b (patch)
tree28b9292ed9cb76b172bec94c6b914ee920c5ae04
parentc97b82da0cda8271e40928d33e8475d5b4cdd0f4 (diff)
downloadrpm-7e5a3ef4250fe760c99a9caea9eed899bc84178b.tar.gz
rpmbuild: Error out if name Obsoletes have invalid characters
Obsoletes work only by package names, but there was no check for tag itself. Let's at least check that Name in Obsoletes contains valid charactes of package names. Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
-rw-r--r--build/parsePreamble.c2
-rw-r--r--build/parseReqs.c8
-rw-r--r--build/rpmbuild_internal.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index a9bd5c36b..d2f1a3eff 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -22,8 +22,6 @@
#define SKIPWHITE(_x) {while (*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while (*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;}
-#define WHITELIST_NAME ".-_+%{}"
-
/**
*/
static const rpmTagVal copyTagsDuringParse[] = {
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 705d4cbbe..715b25e45 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -277,6 +277,14 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
if (checkDep(spec, N, EVR, &emsg))
goto exit;
+ if (nametag == RPMTAG_OBSOLETENAME) {
+ if (rpmCharCheck(spec, N, WHITELIST_NAME)) {
+ rasprintf(&emsg, _("Only package names are allowed in "
+ "Obsoletes"));
+ goto exit;
+ }
+ }
+
if (nametag == RPMTAG_FILETRIGGERNAME ||
nametag == RPMTAG_TRANSFILETRIGGERNAME) {
if (N[0] != '/') {
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index 439b7d3b5..cc9de88f9 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -17,6 +17,8 @@
#undef HTKEYTYPE
#undef HTDATATYPE
+#define WHITELIST_NAME ".-_+%{}"
+
struct TriggerFileEntry {
int index;
char * fileName;