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

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