core: safety check when declaring a cfg structure with empty content
authorDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 21 Apr 2014 15:50:09 +0000 (17:50 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 21 Apr 2014 16:00:34 +0000 (18:00 +0200)
cfg/cfg.c

index 0c4d404..a51d06b 100644 (file)
--- a/cfg/cfg.c
+++ b/cfg/cfg.c
@@ -46,6 +46,9 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int def_size,
        cfg_group_t     *group;
        int types;
 
+       if(def==NULL || def[0].name==NULL)
+               return -1;
+
        /* check the number of the variables */
        for (num=0; def[num].name; num++);