>>>>> "Anthony" == Anthony Green <[EMAIL PROTECTED]> writes:

Anthony>    private void checkZipFile() throws IOException, ZipException
Anthony>    {
Anthony>      byte[] magicBuf = new byte[4];
Anthony> -    raf.read(magicBuf);
Anthony> -    if (readLeInt(magicBuf, 0) != LOCSIG)
Anthony> +    if (raf.read(magicBuf) != 4
Anthony> +      || readLeInt(magicBuf, 0) != LOCSIG)
Anthony>        {
Anthony>        raf.close();
Anthony>        throw new ZipException("Not a valid zip file");

Actually we ought to try reading until we get all 4 bytes or see EOF.
A short read is valid and not an error.

Tom


_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to