summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2021-08-18 11:09:11 +0300
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit84f0308e0be42f65793e668ff7462470995b74d8 (patch)
tree842c64920fd04b20c9a67914d12e79a52110b03e
parent5b58ea7cfbcfb8055e5957fb3abce5c017dc3fa2 (diff)
downloadrpm-84f0308e0be42f65793e668ff7462470995b74d8.tar.gz
Explicitly protect automatic macros from being redefined and undefined
All current automatic macros are named in a way that do not pass the name check in validName(), but that's kinda implicit. Specifically test for ME_AUTO along with ME_BUILTIN. No functional change due to the implicit protection from the naming. (cherry picked from commit b88f43b9a3bf39a92ba8ca511d33fdc60f399c1e)
-rw-r--r--rpmio/macro.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 94ff5187d..3c47d1000 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -608,7 +608,7 @@ validName(MacroBuf mb, const char *name, size_t namelen, const char *action)
}
mep = findEntry(mb->mc, name, namelen, NULL);
- if (mep && (*mep)->flags & ME_BUILTIN) {
+ if (mep && (*mep)->flags & (ME_BUILTIN|ME_AUTO)) {
mbErr(mb, 1, _("Macro %%%s is a built-in (%s)\n"), name, action);
goto exit;
}