diff --git a/jdk/src/java.base/share/native/libzip/zip_util.c b/jdk/src/java.base/share/native/libzip/zip_util.c index d99a5cd66a7..c7505f6aefb 100644 --- a/jdk/src/java.base/share/native/libzip/zip_util.c +++ b/jdk/src/java.base/share/native/libzip/zip_util.c @@ -1206,7 +1206,7 @@ ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash) } /* Slash is already there? */ - if (name[ulen-1] == '/') { + if (ulen > 0 && name[ulen - 1] == '/') { break; }