Blob Blame History Raw
autofs-5.1.0 - fix out of order clearing of options buffer

From: Ian Kent <ikent@redhat.com>

When setting the result of parsing an options string the options buffer
was being cleared before use.
---
 CHANGELOG           |    1 +
 modules/amd_parse.y |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 439a51f..51c935d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -26,6 +26,7 @@
 - fix memory leak in create_client().
 - fix memory leak in get_exports().
 - fix memory leak in get_defaults_entry().
+- fix out of order clearing of options buffer.
 
 04/06/2014 autofs-5.1.0
 =======================
diff --git a/modules/amd_parse.y b/modules/amd_parse.y
index f65ab7a..a7f38f8 100644
--- a/modules/amd_parse.y
+++ b/modules/amd_parse.y
@@ -396,7 +396,6 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
 	}
 	| MNT_OPTION OPTION_ASSIGN options
 	{
-		memset(opts, 0, sizeof(opts));
 		if (!strcmp($1, "opts"))
 			entry.opts = amd_strdup(opts);
 		else if (!strcmp($1, "addopts"))
@@ -407,6 +406,7 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
 			amd_notify($1);
 			YYABORT;
 		}
+		memset(opts, 0, sizeof(opts));
 	}
 	| MNT_OPTION OPTION_ASSIGN
 	{