Fix read-after-free issue parsing config files
We were indirectly adjusting a pointer to a parameter that was declared as a const. This resulted in a use-after-free when using --debug: [11:09:18] debug: config: finished parsing ��A�8_ Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
942bbe2d2d
commit
478af5d1c8
1 changed files with 4 additions and 4 deletions
|
@ -1375,13 +1375,13 @@ int parseconfigfile(const char *file)
|
||||||
{
|
{
|
||||||
struct section_t section = {0};
|
struct section_t section = {0};
|
||||||
char *realfile;
|
char *realfile;
|
||||||
|
int ret;
|
||||||
if((realfile = prepend_dir(config->sysroot, file)) == NULL) {
|
if((realfile = prepend_dir(config->sysroot, file)) == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pm_printf(ALPM_LOG_DEBUG, "config: attempting to read file %s\n", realfile);
|
ret = parse_ini(realfile, _parse_directive, §ion);
|
||||||
free(config->configfile);
|
free(realfile);
|
||||||
config->configfile = realfile;
|
return ret;
|
||||||
return parse_ini(realfile, _parse_directive, §ion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse a configuration file.
|
/** Parse a configuration file.
|
||||||
|
|
Loading…
Add table
Reference in a new issue