ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/stable/0.8/contrib/libarchive/libarchive/archive_write_disk.c
(Generate patch)

Comparing stable/0.8/contrib/libarchive/libarchive/archive_write_disk.c (file contents):
Revision 7621 by laffer1, Wed Apr 13 00:29:37 2016 UTC vs.
Revision 7622 by laffer1, Tue May 31 22:35:12 2016 UTC

# Line 1566 | Line 1566 | cleanup_pathname_win(struct archive_write_disk *a)
1566   /*
1567   * Canonicalize the pathname.  In particular, this strips duplicate
1568   * '/' characters, '.' elements, and trailing '/'.  It also raises an
1569 < * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
1570 < * set) any '..' in the path.
1569 > * error for an empty path, a trailing '..', (if _SECURE_NODOTDOT is
1570 > * set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
1571 > * is set) if the path is absolute.
1572   */
1573   static int
1574   cleanup_pathname(struct archive_write_disk *a)
# Line 1586 | Line 1587 | cleanup_pathname(struct archive_write_disk *a)
1587          cleanup_pathname_win(a);
1588   #endif
1589          /* Skip leading '/'. */
1590 <        if (*src == '/')
1590 >        if (*src == '/') {
1591 >                if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {
1592 >                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1593 >                                          "Path is absolute");
1594 >                        return (ARCHIVE_FAILED);
1595 >                }
1596 >
1597                  separator = *src++;
1598 +        }
1599  
1600          /* Scan the pathname one element at a time. */
1601          for (;;) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines