|
|
beb904 |
autofs-5.1.7 - use mount_fullpath() in one spot in parse_mount()
|
|
|
beb904 |
|
|
|
beb904 |
From: Ian Kent <raven@themaw.net>
|
|
|
beb904 |
|
|
|
beb904 |
mount_fullpath() is meant to be used for this type of path construction
|
|
|
beb904 |
so use it.
|
|
|
beb904 |
|
|
|
beb904 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
beb904 |
---
|
|
|
beb904 |
CHANGELOG | 1 +
|
|
|
beb904 |
modules/parse_sun.c | 34 ++++++++--------------------------
|
|
|
beb904 |
2 files changed, 9 insertions(+), 26 deletions(-)
|
|
|
beb904 |
|
|
|
beb904 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
beb904 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
beb904 |
@@ -43,6 +43,7 @@
|
|
|
beb904 |
- switch to use tree implementation for offsets.
|
|
|
beb904 |
- remove obsolete functions.
|
|
|
beb904 |
- remove redundant local var from sun_mount().
|
|
|
beb904 |
+- use mount_fullpath() in one spot in parse_mount().
|
|
|
beb904 |
|
|
|
beb904 |
xx/xx/2018 autofs-5.1.5
|
|
|
beb904 |
- fix flag file permission.
|
|
|
beb904 |
--- autofs-5.1.4.orig/modules/parse_sun.c
|
|
|
beb904 |
+++ autofs-5.1.4/modules/parse_sun.c
|
|
|
beb904 |
@@ -1356,36 +1356,18 @@ dont_expand:
|
|
|
beb904 |
debug(ap->logopt, MODPREFIX "gathered options: %s", options);
|
|
|
beb904 |
|
|
|
beb904 |
if (check_is_multi(p)) {
|
|
|
beb904 |
- char *m_root = NULL;
|
|
|
beb904 |
+ char m_root[PATH_MAX + 1];
|
|
|
beb904 |
int m_root_len;
|
|
|
beb904 |
time_t age;
|
|
|
beb904 |
int l;
|
|
|
beb904 |
|
|
|
beb904 |
- /* If name starts with "/" it's a direct mount */
|
|
|
beb904 |
- if (*name == '/') {
|
|
|
beb904 |
- m_root_len = name_len;
|
|
|
beb904 |
- m_root = alloca(m_root_len + 1);
|
|
|
beb904 |
- if (!m_root) {
|
|
|
beb904 |
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
beb904 |
- free(options);
|
|
|
beb904 |
- free(pmapent);
|
|
|
beb904 |
- logerr(MODPREFIX "alloca: %s", estr);
|
|
|
beb904 |
- return 1;
|
|
|
beb904 |
- }
|
|
|
beb904 |
- strcpy(m_root, name);
|
|
|
beb904 |
- } else {
|
|
|
beb904 |
- m_root_len = ap->len + name_len + 1;
|
|
|
beb904 |
- m_root = alloca(m_root_len + 1);
|
|
|
beb904 |
- if (!m_root) {
|
|
|
beb904 |
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
beb904 |
- free(options);
|
|
|
beb904 |
- free(pmapent);
|
|
|
beb904 |
- logerr(MODPREFIX "alloca: %s", estr);
|
|
|
beb904 |
- return 1;
|
|
|
beb904 |
- }
|
|
|
beb904 |
- strcpy(m_root, ap->path);
|
|
|
beb904 |
- strcat(m_root, "/");
|
|
|
beb904 |
- strcat(m_root, name);
|
|
|
beb904 |
+ m_root_len = mount_fullpath(m_root, PATH_MAX, ap->path, name);
|
|
|
beb904 |
+ if (!m_root_len) {
|
|
|
beb904 |
+ error(ap->logopt,
|
|
|
beb904 |
+ MODPREFIX "multi-mount root path too long");
|
|
|
beb904 |
+ free(options);
|
|
|
beb904 |
+ free(pmapent);
|
|
|
beb904 |
+ return 1;
|
|
|
beb904 |
}
|
|
|
beb904 |
|
|
|
beb904 |
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
|