|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-12-13 13:52 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Description: ------------ If the command ran by exec outputs a line that is 2*EXEC_INPUT_BUF longer than the previous line a segfault may occur. It is not difficult to see why this happens just by reading the source code. In exec.c, line 118, reads if (buflen < (bufl + EXEC_INPUT_BUF)) { This condition is correct only the first time, e.g when b=buf. I think the like should be if (buflen < (bufl + (b - buf) + EXEC_INPUT_BUF)) { Reproduce code: --------------- #!/usr/local/bin/php <?php $out = array(); $status = -1; exec('/usr/bin/seq 5000 | tr \'\n\' \' \'', $out, $status); print_r($out); ?> Expected result: ---------------- Numbers from 1 to 5000 separated by blanks on one line. Actual result: -------------- segfault