]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
ustar: fix out of bounds read on empty string ("") filename. 750/head
authorCatalin Patulea <catalinp@google.com>
Fri, 22 Jul 2016 15:27:31 +0000 (11:27 -0400)
committerCatalin Patulea <catalinp@google.com>
Fri, 22 Jul 2016 15:27:31 +0000 (11:27 -0400)
libarchive/archive_write_set_format_ustar.c

index 484ab34b2305a1590b957a9ef1a18e2baf407131..797b5334bd4790882522e5695bee400cdab7452d 100644 (file)
@@ -307,7 +307,7 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry)
                 * case getting WCS failed. On POSIX, this is a
                 * normal operation.
                 */
-               if (p != NULL && p[strlen(p) - 1] != '/') {
+               if (p != NULL && p[0] != '\0' && p[strlen(p) - 1] != '/') {
                        struct archive_string as;
 
                        archive_string_init(&as);