[config.c wmfs.c] Fix 2 possible segfault

This commit is contained in:
Martin Duquesnoy 2008-09-29 01:46:24 +02:00
parent 6fc55e469a
commit f501c6762f
2 changed files with 10 additions and 2 deletions

View File

@ -187,7 +187,7 @@ init_conf(void)
static cfg_opt_t key_opts[] =
{
CFG_STR_LIST("mod","{Control}", CFGF_NONE),
CFG_STR_LIST("mod", "{Control}", CFGF_NONE),
CFG_STR("key", "None", CFGF_NONE),
CFG_STR("func", "", CFGF_NONE),
CFG_STR("cmd", "", CFGF_NONE),
@ -318,6 +318,13 @@ init_conf(void)
/* tag */
conf.ntag = cfg_size(cfg_tags, "tag");
if(!conf.ntag)
{
printf("WMFS Configuration: There is no tags in the configuration file\n");
exit(EXIT_FAILURE);
}
for(i = 0; i < conf.ntag; ++i)
{
cfgtmp = cfg_getnsec(cfg_tags, "tag", i);

3
wmfs.c
View File

@ -968,7 +968,8 @@ tag(char *cmd)
}
else
{
if(tmp == seltag)
if(tmp == seltag
|| tmp > conf.ntag)
return;
seltag = tmp;
}