浏览代码

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

Daniel-Constantin Mierla 11 年之前
父节点
当前提交
6f47c9ee24
共有 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++);