Blob Blame History Raw
autofs-5.1.4 - dont use array for path when not necessary

From: Ian Kent <raven@themaw.net>

In parse_amd.c:do_link_mount() a character array is used to construct
a path when a pointer to the relevant amd entry field is sufficient.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 modules/parse_amd.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -291,6 +291,7 @@
 - serialize calls to open_xxxx() functions.
 - fix use after free in do_master_list_reset().
 - fix deadlock in dumpmaps.
+- dont use array for path when not necessary.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/parse_amd.c
+++ autofs-5.0.7/modules/parse_amd.c
@@ -969,8 +969,8 @@ static int do_auto_mount(struct autofs_p
 static int do_link_mount(struct autofs_point *ap, const char *name,
 			 struct amd_entry *entry, unsigned int flags)
 {
-	char target[PATH_MAX + 1];
 	const char *opts = (entry->opts && *entry->opts) ? entry->opts : NULL;
+	char *target;
 	int ret;
 
 	if (entry->sublink) {
@@ -979,14 +979,14 @@ static int do_link_mount(struct autofs_p
 			     "error: sublink option length is too long");
 			return 0;
 		}
-		strcpy(target, entry->sublink);
+		target = entry->sublink;
 	} else {
 		if (strlen(entry->fs) > PATH_MAX) {
 			error(ap->logopt, MODPREFIX
 			     "error: fs option length is too long");
 			return 0;
 		}
-		strcpy(target, entry->fs);
+		target = entry->fs;
 	}
 
 	if (!(flags & CONF_AUTOFS_USE_LOFS))