MSYS2-packages/pacman/0027-Fix-read-after-free-issue-parsing-config-files.patch
Christoph Reiter 1915a138c0 pacman: Update to 6.1.0 (v2)
Same as #4584 but with an additional backport:
https://github.com/msys2/msys2-pacman/pull/49

Old message:

See msys2/msys2-pacman#45

makepkg.conf synced with the upstream version:
https://gitlab.archlinux.org/pacman/pacman/-/blob/v6.1.0/etc/makepkg.conf.in

Skip patches only changing CI configs
2024-05-09 09:45:39 +02:00

41 lines
1.3 KiB
Diff
Raw Blame History

From 215891a06f65982fe831654a3445aab061592129 Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Mon, 18 Mar 2024 11:08:14 +1000
Subject: [PATCH 27/N] Fix read-after-free issue parsing config files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 <20><>A<EFBFBD>8_
Signed-off-by: Allan McRae <allan@archlinux.org>
---
src/pacman/conf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 207ebf7..7318ad5 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -1375,13 +1375,13 @@ int parseconfigfile(const char *file)
{
struct section_t section = {0};
char *realfile;
+ int ret;
if((realfile = prepend_dir(config->sysroot, file)) == NULL) {
return -1;
}
- pm_printf(ALPM_LOG_DEBUG, "config: attempting to read file %s\n", realfile);
- free(config->configfile);
- config->configfile = realfile;
- return parse_ini(realfile, _parse_directive, &section);
+ ret = parse_ini(realfile, _parse_directive, &section);
+ free(realfile);
+ return ret;
}
/** Parse a configuration file.