Browse Source

core: safety check when declaring a cfg structure with empty content

Daniel-Constantin Mierla 11 years ago
parent
commit
6f47c9ee24
1 changed files with 3 additions and 0 deletions
  1. 3 0
      cfg/cfg.c

+ 3 - 0
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++);