autofs/SOURCES/autofs-5.1.4-dont-use-array...

57 lines
1.7 KiB
Diff

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(-)
diff --git a/CHANGELOG b/CHANGELOG
index 0f30596f..13f01397 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@ xx/xx/2018 autofs-5.1.5
- fix directory create permission.
- fix use after free in do_master_list_reset().
- fix deadlock in dumpmaps.
+- dont use array for path when not necessary.
19/12/2017 autofs-5.1.4
- fix spec file url.
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
index c4b3ef0b..2cce5417 100644
--- a/modules/parse_amd.c
+++ b/modules/parse_amd.c
@@ -967,8 +967,8 @@ static int do_auto_mount(struct autofs_point *ap, const char *name,
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) {
@@ -977,14 +977,14 @@ static int do_link_mount(struct autofs_point *ap, const char *name,
"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))