From 5b744892e44259b696aa46f7ccc24526dce5752b Mon Sep 17 00:00:00 2001 From: Catalin Patulea Date: Fri, 22 Jul 2016 11:27:31 -0400 Subject: [PATCH] ustar: fix out of bounds read on empty string ("") filename. --- libarchive/archive_write_set_format_ustar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c index 484ab34b2..797b5334b 100644 --- a/libarchive/archive_write_set_format_ustar.c +++ b/libarchive/archive_write_set_format_ustar.c @@ -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); -- 2.47.2