Re: com php-src: Fixed bug #71039 exec functions ignore length but look for NULL termination: ext/standard/exec.c
ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt

From: Date: Tue, 02 Feb 2016 13:09:15 +0000
Subject: Re: com php-src: Fixed bug #71039 exec functions ignore length but look for NULL termination: ext/standard/exec.c
ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90900@lists.php.net to get a copy of this message
Hi Stas, It's seems patch by Anatol, but anyway On Tue, Jan 12, 2016 at 10:57 PM, Stanislav Malyshev <stas@php.net> wrote: > Diff: > diff --git a/ext/standard/exec.c b/ext/standard/exec.c > index 747f765..29024f6 100644 > --- a/ext/standard/exec.c > +++ b/ext/standard/exec.c > @@ -467,6 +467,10 @@ PHP_FUNCTION(escapeshellcmd) > } > > if (command_len) { > + if (command_len != strlen(command)) { > + php_error_docref(NULL, E_ERROR, "Input string contains NULL > bytes"); > + return; > + } > RETVAL_STR(php_escape_shell_cmd(command)); > } else { > RETVAL_EMPTY_STRING(); > @@ -486,6 +490,10 @@ PHP_FUNCTION(escapeshellarg) > } > > if (argument) { > + if (argument_len != strlen(argument)) { > + php_error_docref(NULL, E_ERROR, "Input string contains NULL > bytes"); > + return; > + } > RETVAL_STR(php_escape_shell_arg(argument)); > } > } These are escape functions. User shouldn't use esacapeshellcmd() for external inputs, but escapeshellarg() will be. The error should be E_RECOVERABLE_ERROR or E_WARNING, so that user can handle errors. Warning and empty string would be enough, IMO. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.cvs (#90900) next »