Project

General

Profile

Bug #55 » 0001-Fix-issue-55.patch

Jason Ish, 01/12/2010 11:04 AM

View differences:

src/conf-yaml-loader.c
level--;
break;
case YAML_SCALAR_EVENT:
if (level < 0) {
/* Don't process values until we've hit a mapping. */
continue;
}
if (state == CONF_KEY) {
if (key[level] != NULL)
free(key[level]);
......
return 1;
}
/**
* This test is mainly to make sure we don't segfaul when passed some
* other file.
*/
static int
ConfYamlNonYamlFileTest(void)
{
ConfCreateContextBackup();
ConfInit();
ConfYamlLoadFile("/etc/passwd");
ConfDeInit();
ConfRestoreContextBackup();
return 1;
}
#endif /* UNITTESTS */
void
......
#ifdef UNITTESTS
UtRegisterTest("ConfYamlRuleFileTest", ConfYamlRuleFileTest, 1);
UtRegisterTest("ConfYamlLoggingOutputTest", ConfYamlLoggingOutputTest, 1);
UtRegisterTest("ConfYamlNonYamlFileTest", ConfYamlNonYamlFileTest, 1);
#endif /* UNITTESTS */
}
(2-2/3)