From: Sebastian Harl Date: Fri, 5 Dec 2008 16:22:53 +0000 (+0100) Subject: configfile.c: Ignore registered undefined config keys. X-Git-Tag: collectd-4.5.2~7 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=de4c4c1a394b70a392aeb85ae770f2381771a428;p=collectd.git configfile.c: Ignore registered undefined config keys. If a registered config key equals NULL, it is now ignored. Before, this would cause a segfault. As this has happened a few times in the past, we not handle it sanely. --- diff --git a/src/configfile.c b/src/configfile.c index b1030fe9..bb57ca26 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -155,7 +155,8 @@ static int cf_dispatch (const char *type, const char *orig_key, for (i = 0; i < cf_cb->keys_num; i++) { - if (strcasecmp (cf_cb->keys[i], key) == 0) + if ((cf_cb->keys[i] != NULL) + && (strcasecmp (cf_cb->keys[i], key) == 0)) { ret = (*cf_cb->callback) (key, value); break;