1

Closed

Don't use hardcoded filename length in ZipEntry.Write.cs - Unicode filenames, max path

description

Hi,
 
In ZipEntry.Write.cs there appear to be some fixed length byte buffers that don't really take unicode into account. For example
 
WriteHeader has this (ZipEntry.Write.cs, Line 703)

 
        byte[] bytes = new byte[512];  // large enough for looooong filenames (MAX_PATH == 260)
 

 
and this
 
        byte[] FileNameBytes = _GetEncodedFileNameBytes();
        Int16 filenameLength = (Int16)FileNameBytes.Length;
 
When I pass in a unicode filename of say 148, I get back a byte buffer of 358.
 
The code should allocate a buffer based on filenameLength .
Closed Jun 14, 2011 at 4:00 AM by Cheeso
fixed in changeset 79084. First binary with this fix: v1.9.1.6.

comments

Nanalich wrote May 23, 2011 at 2:31 AM

I'm just interested why it was fixed?