autofs/autofs-5.1.6-fix-trailing-dollar-sun-entry-expansion.patch
Petr Šabata a275d04aab RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/autofs#1cda5aaae19a25dd9afa10a9ed1763ac59640019
2020-10-14 22:07:18 +02:00

51 lines
1.5 KiB
Diff

autofs-5.1.6 - fix trailing dollar sun entry expansion
From: Ian Kent <raven@themaw.net>
In modules/parse_sun.c:expandsunent() if we see "$ " or "$<NULL>" in
the entry it can't be a macro, and the value can't be quoted since '\'
and '"' cases are handled seperately in the swicth, so treat the
character as a valid entry character.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_sun.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/CHANGELOG b/CHANGELOG
index fa5992aa..07a85cde 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ xx/xx/2020 autofs-5.1.7
- correct fsf address.
- samples: fix Makefile targets' directory dependencies
- remove intr hosts map mount option.
+- fix trailing dollar sun entry expansion.
07/10/2019 autofs-5.1.6
- support strictexpire mount option.
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 71867ef1..f6c22d15 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -161,6 +161,18 @@ int expandsunent(const char *src, char *dst, const char *key,
}
src = p + 1;
} else {
+ /* If the '$' is folloed by a space or NULL it
+ * can't be a macro, and the value can't be
+ * quoted since '\' and '"' cases are handled
+ * in other cases, so treat the $ as a valid
+ * map entry character.
+ */
+ if (isblank(*src) || !*src) {
+ if (dst)
+ *dst++ = ch;
+ len++;
+ break;
+ }
p = src;
while (isalnum(*p) || *p == '_')
p++;