]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Restore modified path after lstat
authorAndrew Gregory <andrew.gregory.8@gmail.com>
Fri, 15 Jan 2016 07:40:00 +0000 (02:40 -0500)
committerAndrew Gregory <andrew.gregory.8@gmail.com>
Tue, 23 Feb 2016 04:15:25 +0000 (23:15 -0500)
check_symlinks is intended to check each component of a path, but failed
to restore the stripped trailing components after each iteration,
leaving a NUL byte in the middle of the path.

libarchive/archive_write_disk_posix.c

index 0fc61930c2ed8449d12fe56223082c67be9e2e04..1eb0e91d71dcdba268e0560245a149a8eedf0b34 100644 (file)
@@ -2447,6 +2447,9 @@ check_symlinks(struct archive_write_disk *a)
                                return (ARCHIVE_FAILED);
                        }
                }
+               pn[0] = c;
+               if (pn[0] != '\0')
+                       pn++; /* Advance to the next segment. */
        }
        pn[0] = c;
        /* We've checked and/or cleaned the whole path, so remember it. */