8079841: Buffer underflow with empty zip entry names
authorjmanson
Tue, 12 May 2015 14:39:36 -0700
changeset 30445 e1e28b9abbe5
parent 30444 054604aed79c
child 30446 1229ff365d57
8079841: Buffer underflow with empty zip entry names Summary: check for zero-length entry name before accessing "last" byte Reviewed-by: sherman, martin
jdk/src/java.base/share/native/libzip/zip_util.c
--- a/jdk/src/java.base/share/native/libzip/zip_util.c	Tue May 12 13:13:06 2015 -0400
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c	Tue May 12 14:39:36 2015 -0700
@@ -1206,7 +1206,7 @@
         }
 
         /* Slash is already there? */
-        if (name[ulen-1] == '/') {
+        if (ulen > 0 && name[ulen - 1] == '/') {
             break;
         }