changeset 30445:e1e28b9abbe5

8079841: Buffer underflow with empty zip entry names Summary: check for zero-length entry name before accessing "last" byte Reviewed-by: sherman, martin
author jmanson
date Tue, 12 May 2015 14:39:36 -0700
parents 054604aed79c
children 1229ff365d57
files jdk/src/java.base/share/native/libzip/zip_util.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }