~ubuntu-branches/ubuntu/saucy/file-roller/saucy-proposed

« back to all changes in this revision

Viewing changes to src/fr-archive-libarchive.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-07-03 16:50:53 UTC
  • mfrom: (1.7.5)
  • Revision ID: package-import@ubuntu.com-20130703165053-13ei2hsf74zr92dy
Tags: 3.8.3-0ubuntu1
* New upstream release. Bugs fixed:
  + Do not allow to save as the original name.
  + New archive: correctly save the archive in the selected destination.
  + libarchive: sanitize filenames before extracting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
512
512
        while ((r = archive_read_next_header (a, &entry)) == ARCHIVE_OK) {
513
513
                const char    *pathname;
514
514
                char          *fullpath;
 
515
                const char    *relative_path;
515
516
                GFile         *file;
516
517
                GFile         *parent;
517
518
                GOutputStream *ostream;
531
532
                }
532
533
 
533
534
                fullpath = (*pathname == '/') ? g_strdup (pathname) : g_strconcat ("/", pathname, NULL);
534
 
                file = g_file_get_child (extract_data->destination, _g_path_get_relative_basename (fullpath, extract_data->base_dir, extract_data->junk_paths));
 
535
                relative_path = _g_path_get_relative_basename_safe (fullpath, extract_data->base_dir, extract_data->junk_paths);
 
536
                if (relative_path == NULL) {
 
537
                        archive_read_data_skip (a);
 
538
                        continue;
 
539
                }
 
540
                file = g_file_get_child (extract_data->destination, relative_path);
535
541
 
536
542
                /* honor the skip_older and overwrite options */
537
543
 
615
621
 
616
622
                        linkname = archive_entry_hardlink (entry);
617
623
                        if (linkname != NULL) {
618
 
                                char  *link_fullpath;
619
 
                                GFile *link_file;
620
 
                                char  *oldname;
621
 
                                char  *newname;
622
 
                                int    r;
 
624
                                char        *link_fullpath;
 
625
                                const char  *relative_path;
 
626
                                GFile       *link_file;
 
627
                                char        *oldname;
 
628
                                char        *newname;
 
629
                                int          r;
623
630
 
624
631
                                link_fullpath = (*linkname == '/') ? g_strdup (linkname) : g_strconcat ("/", linkname, NULL);
625
 
                                link_file = g_file_get_child (extract_data->destination, _g_path_get_relative_basename (link_fullpath, extract_data->base_dir, extract_data->junk_paths));
 
632
                                relative_path = _g_path_get_relative_basename_safe (link_fullpath, extract_data->base_dir, extract_data->junk_paths);
 
633
                                if (relative_path == NULL) {
 
634
                                        g_free (link_fullpath);
 
635
                                        archive_read_data_skip (a);
 
636
                                        continue;
 
637
                                }
 
638
 
 
639
                                link_file = g_file_get_child (extract_data->destination, relative_path);
626
640
                                oldname = g_file_get_path (link_file);
627
641
                                newname = g_file_get_path (file);
628
642