Blame SOURCES/autofs-5.1.4-dont-use-array-for-path-when-not-neccessary.patch

aea863
autofs-5.1.4 - dont use array for path when not necessary
aea863
aea863
From: Ian Kent <raven@themaw.net>
aea863
aea863
In parse_amd.c:do_link_mount() a character array is used to construct
aea863
a path when a pointer to the relevant amd entry field is sufficient.
aea863
aea863
Signed-off-by: Ian Kent <raven@themaw.net>
aea863
---
aea863
 CHANGELOG           |    1 +
aea863
 modules/parse_amd.c |    6 +++---
aea863
 2 files changed, 4 insertions(+), 3 deletions(-)
aea863
aea863
diff --git a/CHANGELOG b/CHANGELOG
aea863
index 0f30596f..13f01397 100644
aea863
--- a/CHANGELOG
aea863
+++ b/CHANGELOG
aea863
@@ -3,6 +3,7 @@ xx/xx/2018 autofs-5.1.5
aea863
 - fix directory create permission.
aea863
 - fix use after free in do_master_list_reset().
aea863
 - fix deadlock in dumpmaps.
aea863
+- dont use array for path when not necessary.
aea863
 
aea863
 19/12/2017 autofs-5.1.4
aea863
 - fix spec file url.
aea863
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
aea863
index c4b3ef0b..2cce5417 100644
aea863
--- a/modules/parse_amd.c
aea863
+++ b/modules/parse_amd.c
aea863
@@ -967,8 +967,8 @@ static int do_auto_mount(struct autofs_point *ap, const char *name,
aea863
 static int do_link_mount(struct autofs_point *ap, const char *name,
aea863
 			 struct amd_entry *entry, unsigned int flags)
aea863
 {
aea863
-	char target[PATH_MAX + 1];
aea863
 	const char *opts = (entry->opts && *entry->opts) ? entry->opts : NULL;
aea863
+	char *target;
aea863
 	int ret;
aea863
 
aea863
 	if (entry->sublink) {
aea863
@@ -977,14 +977,14 @@ static int do_link_mount(struct autofs_point *ap, const char *name,
aea863
 			     "error: sublink option length is too long");
aea863
 			return 0;
aea863
 		}
aea863
-		strcpy(target, entry->sublink);
aea863
+		target = entry->sublink;
aea863
 	} else {
aea863
 		if (strlen(entry->fs) > PATH_MAX) {
aea863
 			error(ap->logopt, MODPREFIX
aea863
 			     "error: fs option length is too long");
aea863
 			return 0;
aea863
 		}
aea863
-		strcpy(target, entry->fs);
aea863
+		target = entry->fs;
aea863
 	}
aea863
 
aea863
 	if (!(flags & CONF_AUTOFS_USE_LOFS))