8079841: Buffer underflow with empty zip entry names

Check for zero-length entry name before accessing "last" byte

Reviewed-by: sherman, martin
This commit is contained in:
Jeremy Manson 2015-05-12 14:39:36 -07:00
parent 5dbc7756f6
commit 292354a1fe

View File

@ -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;
}