Included a patch that avoid a zero length allocation in php_init_config when:
- A configuration line like --with-config-file-scan-dir=d:/local/etc is given
- The directory specified doesn't contain any *.ini filesLet me know if I have to create a bug entry for it before posting a fix.
Eric
Index: php_ini.c
===================================================================
RCS file: /repository/php-src/main/php_ini.c,v
retrieving revision 1.125
diff -u -3 -r1.125 php_ini.c
--- php_ini.c 8 Jan 2004 08:17:53 -0000 1.125
+++ php_ini.c 2 Feb 2004 09:21:19 -0000
@@ -512,13 +512,15 @@
* Don't need an extra byte for the \0 in this malloc as the
last
* element will not get a trailing , which gives us the byte
for the \0
*/
- php_ini_scanned_files = (char *) malloc(total_l);
- *php_ini_scanned_files = '\0';
- for (element = scanned_ini_list.head; element; element =
element->next) {
- strcat(php_ini_scanned_files, *(char
**)element->data);
- strcat(php_ini_scanned_files, element->next ? ",\n" :
"\n");
- }
- zend_llist_destroy(&scanned_ini_list);
+ if( total_l ) {
+ php_ini_scanned_files = (char *) malloc(total_l);
+ *php_ini_scanned_files = '\0';
+ for (element = scanned_ini_list.head; element; element
= element->next) {
+ strcat(php_ini_scanned_files, *(char
**)element->data);
+ strcat(php_ini_scanned_files, element->next ?
",\n" : "\n");
+ }
+ zend_llist_destroy(&scanned_ini_list);
+ }
}
}
return SUCCESS;-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
