Browse code

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

Daniel-Constantin Mierla authored on 21/04/2014 15:50:09
Showing 1 changed files
... ...
@@ -46,6 +46,9 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int def_size,
46 46
 	cfg_group_t	*group;
47 47
 	int types;
48 48
 
49
+	if(def==NULL || def[0].name==NULL)
50
+		return -1;
51
+
49 52
 	/* check the number of the variables */
50 53
 	for (num=0; def[num].name; num++);
51 54