def_load: avoid NULL deref
If econf_getStringValue() fails, it will return an error and set value to NULL. Look for the error and avoid dereferencing value in that case. Signed-off-by: Serge Hallyn <serge@hallyn.com>
This commit is contained in:
parent
9e854f525d
commit
419cf1f1c4
@ -505,7 +505,12 @@ static void def_load (void)
|
|||||||
for (size_t i = 0; i < key_number; i++) {
|
for (size_t i = 0; i < key_number; i++) {
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
econf_getStringValue(defs_file, NULL, keys[i], &value);
|
error = econf_getStringValue(defs_file, NULL, keys[i], &value);
|
||||||
|
if (error) {
|
||||||
|
SYSLOG ((LOG_CRIT, "failed reading key %zu from econf [%s]",
|
||||||
|
i, econf_errString(error)));
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store the value in def_table.
|
* Store the value in def_table.
|
||||||
|
Loading…
Reference in New Issue
Block a user