|
|
29d2b9 |
autofs-5.1.7 - use mount_fullpath() in one spot in parse_mount()
|
|
|
29d2b9 |
|
|
|
29d2b9 |
From: Ian Kent <raven@themaw.net>
|
|
|
29d2b9 |
|
|
|
29d2b9 |
mount_fullpath() is meant to be used for this type of path construction
|
|
|
29d2b9 |
so use it.
|
|
|
29d2b9 |
|
|
|
29d2b9 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
29d2b9 |
---
|
|
|
29d2b9 |
CHANGELOG | 1 +
|
|
|
29d2b9 |
modules/parse_sun.c | 34 ++++++++--------------------------
|
|
|
29d2b9 |
2 files changed, 9 insertions(+), 26 deletions(-)
|
|
|
29d2b9 |
|
|
|
29d2b9 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
29d2b9 |
index 444ade5b..8494f0dc 100644
|
|
|
29d2b9 |
--- a/CHANGELOG
|
|
|
29d2b9 |
+++ b/CHANGELOG
|
|
|
29d2b9 |
@@ -43,6 +43,7 @@
|
|
|
29d2b9 |
- switch to use tree implementation for offsets.
|
|
|
29d2b9 |
- remove obsolete functions.
|
|
|
29d2b9 |
- remove redundant local var from sun_mount().
|
|
|
29d2b9 |
+- use mount_fullpath() in one spot in parse_mount().
|
|
|
29d2b9 |
|
|
|
29d2b9 |
25/01/2021 autofs-5.1.7
|
|
|
29d2b9 |
- make bind mounts propagation slave by default.
|
|
|
29d2b9 |
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
|
|
29d2b9 |
index 437869b5..d3fc6c7f 100644
|
|
|
29d2b9 |
--- a/modules/parse_sun.c
|
|
|
29d2b9 |
+++ b/modules/parse_sun.c
|
|
|
29d2b9 |
@@ -1354,36 +1354,18 @@ dont_expand:
|
|
|
29d2b9 |
debug(ap->logopt, MODPREFIX "gathered options: %s", options);
|
|
|
29d2b9 |
|
|
|
29d2b9 |
if (check_is_multi(p)) {
|
|
|
29d2b9 |
- char *m_root = NULL;
|
|
|
29d2b9 |
+ char m_root[PATH_MAX + 1];
|
|
|
29d2b9 |
int m_root_len;
|
|
|
29d2b9 |
time_t age;
|
|
|
29d2b9 |
int l;
|
|
|
29d2b9 |
|
|
|
29d2b9 |
- /* If name starts with "/" it's a direct mount */
|
|
|
29d2b9 |
- if (*name == '/') {
|
|
|
29d2b9 |
- m_root_len = name_len;
|
|
|
29d2b9 |
- m_root = alloca(m_root_len + 1);
|
|
|
29d2b9 |
- if (!m_root) {
|
|
|
29d2b9 |
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
29d2b9 |
- free(options);
|
|
|
29d2b9 |
- free(pmapent);
|
|
|
29d2b9 |
- logerr(MODPREFIX "alloca: %s", estr);
|
|
|
29d2b9 |
- return 1;
|
|
|
29d2b9 |
- }
|
|
|
29d2b9 |
- strcpy(m_root, name);
|
|
|
29d2b9 |
- } else {
|
|
|
29d2b9 |
- m_root_len = ap->len + name_len + 1;
|
|
|
29d2b9 |
- m_root = alloca(m_root_len + 1);
|
|
|
29d2b9 |
- if (!m_root) {
|
|
|
29d2b9 |
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
29d2b9 |
- free(options);
|
|
|
29d2b9 |
- free(pmapent);
|
|
|
29d2b9 |
- logerr(MODPREFIX "alloca: %s", estr);
|
|
|
29d2b9 |
- return 1;
|
|
|
29d2b9 |
- }
|
|
|
29d2b9 |
- strcpy(m_root, ap->path);
|
|
|
29d2b9 |
- strcat(m_root, "/");
|
|
|
29d2b9 |
- strcat(m_root, name);
|
|
|
29d2b9 |
+ m_root_len = mount_fullpath(m_root, PATH_MAX, ap->path, name);
|
|
|
29d2b9 |
+ if (!m_root_len) {
|
|
|
29d2b9 |
+ error(ap->logopt,
|
|
|
29d2b9 |
+ MODPREFIX "multi-mount root path too long");
|
|
|
29d2b9 |
+ free(options);
|
|
|
29d2b9 |
+ free(pmapent);
|
|
|
29d2b9 |
+ return 1;
|
|
|
29d2b9 |
}
|
|
|
29d2b9 |
|
|
|
29d2b9 |
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
|