]> granicus.if.org Git - php/commitdiff
MFB: Properly address incomplete multibyte chars inside escapeshellcmd()
authorIlia Alshanetsky <iliaa@php.net>
Mon, 17 Mar 2008 23:02:35 +0000 (23:02 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 17 Mar 2008 23:02:35 +0000 (23:02 +0000)
ext/standard/exec.c

index a857e266a2b40b8d39a02bf34bf5c9cccd5dc300..78521eefbde48247a1d4a752ec856bb6d95f785f 100644 (file)
@@ -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 '\'':