1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00

Refine fix for multibyte char hanling inside command names and args

This commit is contained in:
Ilia Alshanetsky
2008-03-20 23:25:31 +00:00
parent b23442fc48
commit 74b5cfdea5
+16 -1
View File
@@ -274,8 +274,13 @@ PHPAPI char *php_escape_shell_cmd(char *str)
cmd = safe_emalloc(2, l, 1);
for (x = 0, y = 0; x < l; x++) {
int mb_len = php_mblen(str + x, (l - x));
/* skip non-valid multibyte characters */
if (php_mblen(str + x, (l - x)) < 0) {
if (mb_len < 0) {
continue;
} else if (mb_len > 1) {
x += mb_len - 1;
continue;
}
@@ -356,6 +361,16 @@ PHPAPI char *php_escape_shell_arg(char *str)
#endif
for (x = 0; x < l; x++) {
int mb_len = php_mblen(str + x, (l - x));
/* skip non-valid multibyte characters */
if (mb_len < 0) {
continue;
} else if (mb_len > 1) {
x += mb_len - 1;
continue;
}
switch (str[x]) {
#ifdef PHP_WIN32
case '"':