2
0
Эх сурвалжийг харах

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

(cherry picked from commit 6f47c9ee24adea03df58e84d296e9682e5f81286)
(cherry picked from commit 24ba3f86d29ffb250663e32c3d60592bb1f15c86)
Daniel-Constantin Mierla 11 жил өмнө
parent
commit
a495f5a1c4
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  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++);