PHP 4.0 Bug #5898: php crashes trying to estrdup nonexistant environment variables
| From: | Mario dot Lorenz at geyer dot kabeljournal dot de | Date: | Tue, 01 Aug 2000 12:25:52 +0000 |
| Subject: | PHP 4.0 Bug #5898: php crashes trying to estrdup nonexistant environment variables | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-27232@lists.php.net to get a copy of this message | ||
From: Mario.Lorenz@geyer.kabeljournal.de
Operating system: Linux, RedHat 6.1
PHP version: 4.0.1pl2
PHP Bug Type: Reproduceable crash
Bug description: php crashes trying to estrdup nonexistant environment variables
This is plain 4.0.1pl2 in CGI mode on a RedHat 6.1 (patched up) sytem, however with Apache 1.3.3
(admitted, its oldish).
Setup is plain ./configure without any further options.
Whenever trying run a php4 script on that machine, php crashes (and httpd displays the preliminary
end of script
error message).
Researching the problem showed:
It crashes in zend_alloc.c:289 (_estrdup)
called by cgi_main Line 632 trying to estrdup the PATH_TRANSLATED environment variable. Since that
environment
variable is not set (this part I blame to my old apache)
it tries to strlen(0) (as thats what was returned by getenv)
and therefore segfaults.
Verified that by putting a wrapper around the scrip that would set the PATH_TRANSLATED variable, and
voila, all went OK.
While I admit that in part this problem is caused by
the old apache, I also hold that no program should ever segfault, in particularly no attack-exposed
program like
PHP.