From: Ilia Alshanetsky Date: Mon, 17 Mar 2008 23:02:35 +0000 (+0000) Subject: MFB: Properly address incomplete multibyte chars inside escapeshellcmd() X-Git-Tag: RELEASE_2_0_0a1~116 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b32865ffca27ebd55401f18f9d82bab76167d66;p=php MFB: Properly address incomplete multibyte chars inside escapeshellcmd() --- diff --git a/ext/standard/exec.c b/ext/standard/exec.c index a857e266a2..78521eefbd 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -256,6 +256,11 @@ PHPAPI char *php_escape_shell_cmd(char *str) cmd = safe_emalloc(2, l, 1); for (x = 0, y = 0; x < l; x++) { + /* skip non-valid multibyte characters */ + if (php_mblen(str + x, (l - x)) < 0) { + continue; + } + switch (str[x]) { case '"': case '\'':