diff options
author | Berke Viktor <berkeviktor@aol.com> | 2011-12-01 21:25:17 +0100 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2011-12-01 21:25:17 +0100 |
commit | a3a6346fec2b7696b80a4a3fce1bbc3d93a71002 (patch) | |
tree | 63b8be92eb01a268a7a7016606495dcdd1f98675 | |
parent | 455032938a9d5336e55684692113fbca8a156810 (diff) |
fix cfgfiles bug when variable names include each other
-rw-r--r-- | src/common/cfgfiles.c | 6 |
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); |