From: Michihiro NAKAJIMA Date: Sun, 2 Dec 2012 11:30:49 +0000 (+0900) Subject: Fix the potential for a buffer underflow. X-Git-Tag: v3.1.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bfbc9948d5ba7bb691e254ba530c682b530e630;p=thirdparty%2Flibarchive.git Fix the potential for a buffer underflow. --- diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index 974fd67e4..3d8b3b5f9 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -893,7 +893,8 @@ path_length(struct archive_entry *entry) if (path == NULL) return (0); - if ((type == AE_IFDIR) & (path[strlen(path) - 1] != '/')) { + if (type == AE_IFDIR && + (path[0] == '\0' || path[strlen(path) - 1] != '/')) { return strlen(path) + 1; } else { return strlen(path);