[pacman-dev] [PATCH] Fix segfault importing PGP key for pacman -U operations

Allan McRae allan at archlinux.org
Thu Oct 24 13:41:24 UTC 2019


Use after free.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/be_package.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 0f45c331..73d466de 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -759,7 +759,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
 					if(_alpm_key_in_keychain(handle, key) == 0) {
 						pkg_temp = _alpm_pkg_load_internal(handle, filename, full);
 						if(pkg_temp) {
-							packager = pkg_temp->packager;
+							packager = strdup(pkg_temp->packager);
 							_alpm_pkg_free(pkg_temp);
 						} else {
 							packager = NULL;
-- 
2.23.0


More information about the pacman-dev mailing list