I’m making a PHP script that retrieve user-given zip files, unzip it, and do some stuff with the files in it, using a ZipArchive object. How can I avoid zip bombs like 42.zip?
I’m making a PHP script that retrieve user-given zip files, unzip it, and do
Share
Check out zip_entry_filesize: http://php.net/manual/en/function.zip-entry-filesize.php
It should give you the actual size of the uncompressed archive within the .zip file. Here’s an example function provided in a comment on the manual page: