php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5447 Apache Seg. Fault while using posix_getpwuid()
Submitted: 2000-07-08 00:51 UTC Modified: 2000-11-27 05:21 UTC
From: jasonc at webpipe dot net Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.0 OS: Redhat 6.2
Private report: No CVE-ID: None
 [2000-07-08 00:51 UTC] jasonc at webpipe dot net
The following causes an Apache Seg Fault:

<?
        $dir = "/var/tmp";
        exec("ls $dir",$dir_content,$returnVal);
        if($returnVal == 1)
        {       
                echo"Unable to process request.<br>";
        }
?>
<html>
<body>
<?      
        for($i =0; $i < count($dir_content); $i++)
        {       
                $file = $dir."/".$dir_content[$i];
                echo $file." -- ";
                $owner_info = posix_getpwuid(fileowner($file));
                echo $owner_info["name"]."<br>\n";
        }
?>
</body>
</html>

PHP Configuration:
'./configure' '--with-apache=../apache_1.3.12' '--with-config-file-path=/usr/local/apache/conf/' '--enable-track-vars' '--enable-magic-quotes' '--with-cybercash=/usr/local/cybercash/' '--with-gd=/usr/local/gd-1.8.3/' '--with-jpeg-dir=/usr/local/gd-1.8.3/' '--with-ttf=/usr/local/gd-1.8.3/' '--with-imap=/usr/local/imap/' '--with-mysql=/usr/local/mysql/' '--with-pdflib=/usr/local/lib/' '--with-pgsql=/usr/local/pgsql/' '--disable-debug'

If you need a copy of php.ini, let me know.

If I hardcode a file within the loop like "/tmp/test.txt" it works fine.  It has problems when it steps through the array.  However, if you comment out the line with the posix_getpwuid() function, everything works fine.

Jason

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-08 10:47 UTC] stas at cvs dot php dot net
Fixed in latest CVS. Please check.
 [2000-09-28 07:06 UTC] jasonc at webpipe dot net
As of 4.0.2, it still doesn't work.

Jason
 [2000-09-28 07:33 UTC] jasonc at webpipe dot net
OK.  This is really weird and I can't figure this out.  If the directory is /tmp, /usr, or /usr/local, it works great.  If it's something like /usr/bin or /home, it chokes.  I originally thought that it might be a permissions thing but that doesn't seem to be it.  Another weird thing with this is that IE prints "Cannot find server" for the title even if the script works and a title is specified and prints in the source.

Let me know if I can provide any additional info.

Jason
 [2000-11-27 05:21 UTC] sniper@php.net
I can not reproduce this with latest CVS.
IE sometimes seems to cache error pages so try
to refresh the page with <ctrl+shift>+Reload.

Reopen if problem still exists with latest snapshot
from http://snaps.php.net/

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 14:01:34 2024 UTC