summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-12-01 21:25:17 +0100
committerBerke Viktor <berkeviktor@aol.com>2011-12-01 21:25:17 +0100
commita3a6346fec2b7696b80a4a3fce1bbc3d93a71002 (patch)
tree63b8be92eb01a268a7a7016606495dcdd1f98675 /src/common
parent455032938a9d5336e55684692113fbca8a156810 (diff)
fix cfgfiles bug when variable names include each other
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cfgfiles.c6
1 files changed, 5 insertions, 1 deletions
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);