Blame SOURCES/autofs-5.1.7-use-mount_fullpath-in-one-spot-in-parse_mount.patch

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