Blame SOURCES/autofs-5.1.0-beta1-fix-incorrect-max-key-length-in-defaults-get_hash.patch

306fa1
autofs-5.1.0-beta1 - fix incorrect max key length in defaults get_hash()
306fa1
306fa1
From: Ian Kent <ikent@redhat.com>
306fa1
306fa1
amd section names can correspond to mount point path names.
306fa1
---
306fa1
 CHANGELOG      |    1 +
306fa1
 lib/defaults.c |    6 ++++--
306fa1
 2 files changed, 5 insertions(+), 2 deletions(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -114,6 +114,7 @@
306fa1
 - fix ldap default schema config.
306fa1
 - fix ldap default master map name config.
306fa1
 - fix map format init in lookup_init().
306fa1
+- fix incorrect max key length in defaults get_hash().
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/lib/defaults.c
306fa1
+++ autofs-5.0.7/lib/defaults.c
306fa1
@@ -43,7 +43,6 @@
306fa1
 #define OLD_CONFIG_FILE			AUTOFS_CONF_DIR "/autofs"
306fa1
 #define MAX_LINE_LEN			256
306fa1
 #define MAX_SECTION_NAME		MAX_LINE_LEN
306fa1
-#define MAX_CFG_NAME_LEN		31
306fa1
 
306fa1
 #define NAME_MASTER_MAP			"master_map_name"
306fa1
 
306fa1
@@ -665,7 +664,7 @@ error:
306fa1
 static u_int32_t get_hash(const char *key, unsigned int size)
306fa1
 {
306fa1
 	const char *pkey = key;
306fa1
-	char lkey[MAX_CFG_NAME_LEN];
306fa1
+	char lkey[PATH_MAX + 1];
306fa1
 	char *plkey = &lkey[0];
306fa1
 
306fa1
 	while (*pkey)
306fa1
@@ -683,6 +682,9 @@ static struct conf_option *conf_lookup(c
306fa1
 	if (!key || !section)
306fa1
 		return NULL;
306fa1
 
306fa1
+	if (strlen(key) > PATH_MAX)
306fa1
+		return NULL;
306fa1
+
306fa1
 	key_hash = get_hash(key, size);
306fa1
 	for (co = config->hash[key_hash]; co != NULL; co = co->next) {
306fa1
 		if (strcasecmp(section, co->section))