|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-16 15:59 UTC] manuel at mausz dot at
Description:
------------
There's a memory leak in php_exec. The escaped command never gets freed.
--- ./ext/standard/exec.c.orig 2008-03-16 16:52:08.000000000 +0100
+++ ./ext/standard/exec.c 2008-03-16 16:51:54.000000000 +0100
@@ -116,6 +116,7 @@
#else
fp = VCWD_POPEN(cmd_p, "r");
#endif
+ efree(cmd_p);
if (!fp) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to fork [%s]", cmd);
goto err;
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 17:00:01 2025 UTC |
That's the correct patch: --- php-5.2.5/ext/standard/exec.c.orig 2008-03-16 17:15:28.000000000 +0100 +++ php-5.2.5/ext/standard/exec.c 2008-03-16 17:16:26.000000000 +0100 @@ -87,7 +87,7 @@ efree(d); d = cmd_p; } else { - cmd_p = cmd; + cmd_p = estrdup(cmd); } #if PHP_SIGCHILD @@ -99,6 +99,7 @@ #else fp = VCWD_POPEN(cmd_p, "r"); #endif + efree(cmd_p); if (!fp) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to fork [%s]", cmd); goto err;Hello, you have a reprocuce script? I'm not see leak here. We have: if (...) { /* ... */ cmd_p = php_escape_shell_cmd(d); efree(d); d = cmd_p; } else { cmd_p = cmd; } and: if (d) { efree(d); } Destined to free the escaped cmd.