From be1055f2cc8841954521bf30a6f886cf3c807a28 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Fri, 10 Dec 2021 17:00:32 +0100 Subject: [PATCH] extract_archive: use copy_pathname instead of set_pathname. Libarchive documentation mentions that archive_entry_set_pathname expects us to keep the passed string alive, which we don't. --- src/libutil/tarfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 50e691a3d..934b70162 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -93,7 +93,7 @@ static void extract_archive(TarArchive & archive, const Path & destDir) else archive.check(r); - archive_entry_set_pathname(entry, + archive_entry_copy_pathname(entry, (destDir + "/" + name).c_str()); archive.check(archive_read_extract(archive.archive, entry, flags));