summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2008-03-17 23:01:27 +0000
committerIlia Alshanetsky <iliaa@php.net>2008-03-17 23:01:27 +0000
commit9227974ddb44f367b2ed7b0885f3b39169597ca7 (patch)
treeb23ca366ff01cbf5871161223395e44658248bf4
parent42d4cf65311ecc790c21a1693360a0e7ca1f423e (diff)
downloadphp-git-9227974ddb44f367b2ed7b0885f3b39169597ca7.tar.gz
Properly address incomplete multibyte chars inside escapeshellcmd()
-rw-r--r--ext/standard/exec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index aedfa94ce2..32e0f693ea 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -271,6 +271,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 '\'':