tony2001 Tue, 20 Oct 2009 12:57:44 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=289795
Log: fix crash on empty doc_root Changed paths: U php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c U php/php-src/branches/PHP_5_3_1/sapi/cgi/cgi_main.c U php/php-src/trunk/sapi/cgi/cgi_main.c Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2009-10-20 12:55:32 UTC (rev 289794) +++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2009-10-20 12:57:44 UTC (rev 289795) @@ -828,7 +828,7 @@ /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */ if (doc_root) { doc_root_len = strlen(doc_root); - if (IS_SLASH(doc_root[doc_root_len - 1])) { + if (doc_root_len > 0 && IS_SLASH(doc_root[doc_root_len - 1])) { --doc_root_len; } #ifdef PHP_WIN32 Modified: php/php-src/branches/PHP_5_3_1/sapi/cgi/cgi_main.c =================================================================== --- php/php-src/branches/PHP_5_3_1/sapi/cgi/cgi_main.c 2009-10-20 12:55:32 UTC (rev 289794) +++ php/php-src/branches/PHP_5_3_1/sapi/cgi/cgi_main.c 2009-10-20 12:57:44 UTC (rev 289795) @@ -828,7 +828,7 @@ /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */ if (doc_root) { doc_root_len = strlen(doc_root); - if (IS_SLASH(doc_root[doc_root_len - 1])) { + if (doc_root_len > 0 && IS_SLASH(doc_root[doc_root_len - 1])) { --doc_root_len; } #ifdef PHP_WIN32 Modified: php/php-src/trunk/sapi/cgi/cgi_main.c =================================================================== --- php/php-src/trunk/sapi/cgi/cgi_main.c 2009-10-20 12:55:32 UTC (rev 289794) +++ php/php-src/trunk/sapi/cgi/cgi_main.c 2009-10-20 12:57:44 UTC (rev 289795) @@ -825,7 +825,7 @@ /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */ if (doc_root) { doc_root_len = strlen(doc_root); - if (IS_SLASH(doc_root[doc_root_len - 1])) { + if (doc_root_len > 0 && IS_SLASH(doc_root[doc_root_len - 1])) { --doc_root_len; } #ifdef PHP_WIN32
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php