From a3a6346fec2b7696b80a4a3fce1bbc3d93a71002 Mon Sep 17 00:00:00 2001
From: Berke Viktor <berkeviktor@aol.com>
Date: Thu, 1 Dec 2011 21:25:17 +0100
Subject: [PATCH] fix cfgfiles bug when variable names include each other

---
 src/common/cfgfiles.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index e5d0eaef..22ef00d7 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -164,9 +164,13 @@ list_delentry (GSList ** list, char *name)
 char *
 cfg_get_str (char *cfg, char *var, char *dest, int dest_len)
 {
+	char buffer[128];	/* should be plenty for a variable name */
+
+	sprintf (buffer, "%s ", var);	/* add one space, this way it works against var - var2 checks too */
+
 	while (1)
 	{
-		if (!strncasecmp (var, cfg, strlen (var)))
+		if (!strncasecmp (buffer, cfg, strlen (var) + 1))
 		{
 			char *value, t;
 			cfg += strlen (var);