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ò
This commit is contained in:
kientzle 2007-03-01 06:22:34 +00:00
parent a843fe0d34
commit c00cd44eca
3 changed files with 8 additions and 1 deletions

View File

@ -759,6 +759,12 @@ archive_entry_set_symlink(struct archive_entry *entry, const char *linkname)
aes_set_mbs(&entry->ae_symlink, 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)
{

View File

@ -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 *);

View File

@ -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.