Unicode filenames, max path

May 10, 2011 at 10:08 PM


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


            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.


Is it ok to just change to code to allocate a buffer based on filenameLength ?





May 19, 2011 at 7:34 PM

Hi John,

Yes, what you are saying sounds reasonable to do.


May 19, 2011 at 7:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.