php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23669 Segmentation fault occurs when calling PHP CGI as directory index
Submitted: 2003-05-17 00:31 UTC Modified: 2003-05-17 13:57 UTC
From: m5issige at mr dot hitachi-medical dot co dot jp Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 4.3.2RC3 OS: SunOS 5.6
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: m5issige at mr dot hitachi-medical dot co dot jp
New email:
PHP Version: OS:

 

 [2003-05-17 00:31 UTC] m5issige at mr dot hitachi-medical dot co dot jp
When calling PHP script as directory index, it will be terminated with segment fault in file cgi_main.c at line 709.

sapi/cgi/cgi_main.c:
    708             if (stat( script_path_translated, &st ) == -1 ) {
    709                 char *pt = estrdup(script_path_translated);
    710                 int len = strlen(pt);
    711                 char *ptr;

Test script:
<?php phpinfo(); ?>

Apatch setting (in .htaccess):
DirectoryIndex index.cgi index.html

Then, access to http://myhost.example.com/path/to/parent/directory/of/the/script/

Environment:
SunOS 5.6 with Apache 1.2.4 (yep, very old...)

Configure:
--prefix=$HOME --disable-cli
--disable-all --without-mysql --enable-safe-mode
--with-pcre-regex --with-regex=php --enable-mbstring
--enable-mbregex --enable-zend-multibyte --enable-fastcgi
--enable-session
(I can not swith to root, so I install PHP into my own directory)

Osamu Shigematsu

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-17 03:47 UTC] moriyoshi@php.net
I can replicate the problem with the following shell script:

#!/bin/sh
REDIRECT_STATUS=200
REDIRECT_URL=/
REQUEST_METHOD=GET
REQUEST_URI=/
SCRIPT_FILENAME=blah
SCRIPT_NAME=/index.cgi
QUERY_STRING=

export REDIRECT_STATUS REDIRECT_URL REQUEST_METHOD REQUEST_URI PATH_TRANSLATED PATH_INFO SCRIPT_FILENAME SCRIPT_NAME QUERY_STRING 

gdb sapi/cgi/php

 [2003-05-17 13:57 UTC] moriyoshi@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC