]> granicus.if.org Git - php/commitdiff
Fixed crash in zip extract method (possible CWE-170)
authorPierre Joye <pajoye@php.net>
Tue, 30 Nov 2010 11:04:06 +0000 (11:04 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 30 Nov 2010 11:04:06 +0000 (11:04 +0000)
NEWS
ext/zip/php_zip.c

diff --git a/NEWS b/NEWS
index 5eef9f2958ea12b8ae7bc4d5b37c2dd42b155e74..2b136343d97789b986659ead5cdb0eb826bf4eb5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,8 @@
 - Upgraded bundled PCRE to version 8.10. (Ilia)
 
 - Security enhancements:
+  . Fixed crash in zip extract method (possible CWE-170). 
+    (Maksymilian Arciemowicz, Pierre)
   . Paths with NULL in them (foo\0bar.txt) are now considered as invalid. (Rasmus)
   . Fixed a possible double free in imap extension (Identified by Mateusz 
     Kocielski). (CVE-2010-4150). (Ilia)
index 5c291381c51ef93f8e19e26f3c739448740506d2..1b42c94457d92022da58d403ff086adaa8f95506 100644 (file)
@@ -162,6 +162,9 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
         */
        virtual_file_ex(&new_state, file, NULL, CWD_EXPAND);
        path_cleaned =  php_zip_make_relative_path(new_state.cwd, new_state.cwd_length);
+       if(!path_cleaned) {
+               return 0;
+       }
        path_cleaned_len = strlen(path_cleaned);
 
        if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {