|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-01-11 11:59 UTC] wharmby at uk dot ibm dot com
Description: ------------ The current implementation of php_fopen_primary_script() uses the non-reentrant getpwnam() rather than the re-entrant getpwnam_r(). Therefore calling it on a Linux ZTS enabled build could lead to unpredictable/undesirable results. The code should use the re-entrant version if it is available. The following patch which were built against the latest snapshot (Jan 11 2007, 0730 GMT) modifies the code in main/fopen_wrappers.c to use the re-entrant getpwnam_r if its available: http://pastebin.ca/312969 Fix tested on Linux RHEL4 with Apache 2.0.52 and user_dir set in php.ini The modified code was then driven by specifying the ~user_id in the URL e.g http://localhost/~andy/phpinfo.php. Reproduce code: --------------- Problem found by code inspection. As with most thread safety issues difficult to produce a simple testcase which will show a reproducible crash but current Linux executable is clearly not reentrant and therefore not thread safe. Expected result: ---------------- N/A Actual result: -------------- N/A PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Hi Ilia Thanks for applying the fix for this defect. However, in adjusting the fix to deal with the SYSCONF errors I believe you have introduced a storage leak. The code as it stands does not free "pwbuf" if the call to getpwnam_r is successful after it has finished extracting the data from it. Here is a patch for the missing code built against latest snapshot for 5.2: http://www.pastebin.ca/313940 Regards Andy