diff options
author | Tim Kientzle <kientzle@FreeBSD.org> | 2007-03-01 06:22:34 +0000 |
---|---|---|
committer | Tim Kientzle <kientzle@FreeBSD.org> | 2007-03-01 06:22:34 +0000 |
commit | 6fccc5ecd48f204d60db036d4bfe365c5a9ff216 (patch) | |
tree | 20547f42903c25a22f7baef1ee353b35a41cfe60 | |
parent | b32fedf48fa6a5f0f1838e8c520de79117b566ae (diff) |
Because the buffer gets released immediately, I need to
copy the symlink target name, not just copy the reference.
This problem sometimes caused crashes when extracting
symlinks from ISO9660 images.
Thanks to: Diego "Flameeyes" Pettenò
Notes
Notes:
svn path=/head/; revision=167132
-rw-r--r-- | lib/libarchive/archive_entry.c | 6 | ||||
-rw-r--r-- | lib/libarchive/archive_entry.h | 1 | ||||
-rw-r--r-- | lib/libarchive/archive_read_support_format_iso9660.c | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/lib/libarchive/archive_entry.c b/lib/libarchive/archive_entry.c index e3737a6440f9..646f31422199 100644 --- a/lib/libarchive/archive_entry.c +++ b/lib/libarchive/archive_entry.c @@ -760,6 +760,12 @@ archive_entry_set_symlink(struct archive_entry *entry, const char *linkname) } void +archive_entry_copy_symlink(struct archive_entry *entry, const char *linkname) +{ + aes_copy_mbs(&entry->ae_symlink, linkname); +} + +void archive_entry_copy_symlink_w(struct archive_entry *entry, const wchar_t *linkname) { aes_copy_wcs(&entry->ae_symlink, linkname); diff --git a/lib/libarchive/archive_entry.h b/lib/libarchive/archive_entry.h index 5e6c9fdea372..2604f8623540 100644 --- a/lib/libarchive/archive_entry.h +++ b/lib/libarchive/archive_entry.h @@ -130,6 +130,7 @@ void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); void archive_entry_set_rdevminor(struct archive_entry *, dev_t); void archive_entry_set_size(struct archive_entry *, int64_t); void archive_entry_set_symlink(struct archive_entry *, const char *); +void archive_entry_copy_symlink(struct archive_entry *, const char *); void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *); void archive_entry_set_uid(struct archive_entry *, uid_t); void archive_entry_set_uname(struct archive_entry *, const char *); diff --git a/lib/libarchive/archive_read_support_format_iso9660.c b/lib/libarchive/archive_read_support_format_iso9660.c index 20c8ecc71efe..a2dc6fd159f4 100644 --- a/lib/libarchive/archive_read_support_format_iso9660.c +++ b/lib/libarchive/archive_read_support_format_iso9660.c @@ -378,7 +378,7 @@ archive_read_format_iso9660_read_header(struct archive *a, archive_entry_set_pathname(entry, build_pathname(&iso9660->pathname, file)); if (file->symlink.s != NULL) - archive_entry_set_symlink(entry, file->symlink.s); + archive_entry_copy_symlink(entry, file->symlink.s); /* If this entry points to the same data as the previous * entry, convert this into a hardlink to that entry. |