]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Correct the usage of PATH_MAX as reported in Issue #744.
authorTim Kientzle <kientzle@gmail.com>
Wed, 10 Aug 2016 01:35:38 +0000 (21:35 -0400)
committerTim Kientzle <kientzle@gmail.com>
Wed, 10 Aug 2016 01:35:38 +0000 (21:35 -0400)
libarchive/archive_write_disk_posix.c

index 67aacf15a004649576056bcae31fd3f113f33017..39ee3b67a4a898a2dd72a8713814f3d934c8b9ad 100644 (file)
@@ -1796,7 +1796,7 @@ edit_deep_directories(struct archive_write_disk *a)
        char *tail = a->name;
 
        /* If path is short, avoid the open() below. */
-       if (strlen(tail) <= PATH_MAX)
+       if (strlen(tail) < PATH_MAX)
                return;
 
        /* Try to record our starting dir. */
@@ -1806,7 +1806,7 @@ edit_deep_directories(struct archive_write_disk *a)
                return;
 
        /* As long as the path is too long... */
-       while (strlen(tail) > PATH_MAX) {
+       while (strlen(tail) >= PATH_MAX) {
                /* Locate a dir prefix shorter than PATH_MAX. */
                tail += PATH_MAX - 8;
                while (tail > a->name && *tail != '/')