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

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