]> granicus.if.org Git - php/commitdiff
nullify opened_path and filename (when required)
authorAntony Dovgal <tony2001@php.net>
Thu, 23 Nov 2006 22:04:32 +0000 (22:04 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 23 Nov 2006 22:04:32 +0000 (22:04 +0000)
fixes invalid reads with `php-cli -F <script>`

Zend/zend_language_scanner.l

index 54328906c9f1de5536697e18b01ba92f02b5d9e3..b1573c58e62af83f4fc51c3a2769186e746f3745 100644 (file)
@@ -281,6 +281,11 @@ int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2)
 ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
 {
        zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
+       /* zend_file_handle_dtor() operates on the copy, so we have to NULLify the original here */
+       file_handle->opened_path = NULL;
+       if (file_handle->free_filename) {
+               file_handle->filename = NULL;
+       }
 }
 
 /* Convert one octal digit to a numeric value 0..7, or -1 on failure */