View Single Post
Old 09-28-2005, 03:38 AM  
FTPServerTools
Senior Member
 
Join Date: Sep 2002
Posts: 543
Default

Hmm if it uses unzip.exe then it must go good.

Harm the bad zip files I found are the ones that have extra's added to the end of a proper zip. There is some gl code I bet that screws up zip files when it adds comments. Every now and then I see a zip file where there a complete zip file, then a new zip header then an nfo header followed by a packed nfo file. This is basically bad coding according to the zip standards, it isnt allowed. The extra zip header isnt allowed to be glued to the end of a zip.
In short:
if (((*ZipHeader & 0x0000FFFF)==0x00004B50) && (*ZipHeader!=0x04034B50)) Start+=4; //PK00
//NITROUS is using a bad zipper whcih gets recognized tho. It preadds PK00 so the header looks like PK00PK... so lets check for PK??PK..
for (DWORD i=Start;i<_msize(mem){
zl=(struct ZipLocalFileHeader *)&mem[i];
if (zl->Signature!=0x04034B50) break; // No localfileheader
nrBytesToWrite=zl->FilenameLength+zl->ExtraFieldLength+zl->CompressedSize;
if (zl->Flags & 0x08) nrBytesToWrite+=12; //General purpose flag bit3 set -> Data descriptor follows
i+=sizeof(*zl)+nrBytesToWrite;
}
So in short that is what I do to check this.

Whether these files still come by I havent checked anymore, they get auto repaired with my FTPLogger.

And zkinner, since unzip is being used be sure to use the latest unzip and check your paths for duplicates of unzip.exe. There are older versions which do not support various of the newer zip packing types (mainly deflate64 and multi disk zipping).
FTPServerTools is offline   Reply With Quote