mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
Duplicate the result of archive_entry_pathname.
After the libarchive upgrade from 2.4.12 to 2.4.14, our usage of archive_entry_pathname became dangerous. We were using the result of that function even after calls to archive_entry_set_pathname. With 2.4.14, the entryname becomes wrong after these calls, and so all the future use of entryname are bogus. entryname is used quite a lot for logging, so that's not so bad. But it's also used for the backup handling, so that's not very cool. For example, reinstalling a package with backup entries will erase all the md5 entries from the DB, because they won't be found back. entryname is now a static string so that we can easily keep the result of archive_entry_pathname. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: fixed version numbers in commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
562442633a
commit
3fe43ffa04
@ -290,7 +290,7 @@ static int extract_single_file(struct archive *archive,
|
||||
struct archive_entry *entry, pmpkg_t *newpkg, pmpkg_t *oldpkg,
|
||||
pmtrans_t *trans, pmdb_t *db)
|
||||
{
|
||||
const char *entryname; /* the name of the file in the archive */
|
||||
char entryname[PATH_MAX]; /* the name of the file in the archive */
|
||||
mode_t entrymode;
|
||||
char filename[PATH_MAX]; /* the actual file we're extracting */
|
||||
int needbackup = 0, notouch = 0;
|
||||
@ -300,7 +300,7 @@ static int extract_single_file(struct archive *archive,
|
||||
ARCHIVE_EXTRACT_TIME;
|
||||
int errors = 0;
|
||||
|
||||
entryname = archive_entry_pathname(entry);
|
||||
strncpy(entryname, archive_entry_pathname(entry), PATH_MAX);
|
||||
entrymode = archive_entry_mode(entry);
|
||||
|
||||
memset(filename, 0, PATH_MAX); /* just to be sure */
|
||||
|
Loading…
Reference in New Issue
Block a user