com php-src: Fix bug #69646 OS command inject ion vulnerability in escapeshellarg: ext/standard/exe c.c
| From: | Stanislav Malyshev | Date: | Tue, 09 Jun 2015 17:52:38 +0000 |
| Subject: | com php-src: Fix bug #69646 OS command inject ion vulnerability in escapeshellarg: ext/standard/exe c.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87132@lists.php.net to get a copy of this message | ||
Commit: 80367584910885baa1a2a4476a4a31efdcf0c9c0
Author: Stanislav Malyshev <stas@php.net> Sun, 31 May 2015 22:53:35 -0700
Parents: f7d7befae8bcc2db0093f8adaa9f72eeb7ad891e
Branches: PHP-5.4
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=80367584910885baa1a2a4476a4a31efdcf0c9c0
Log:
Fix bug #69646 OS command injection vulnerability in escapeshellarg
Bugs:
https://bugs.php.net/69646
Changed paths:
M ext/standard/exec.c
Diff:
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index d6938a4..d0b1e01 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -380,6 +380,14 @@ PHPAPI char *php_escape_shell_arg(char *str)
}
}
#ifdef PHP_WIN32
+ if (y > 0 && '\\' == cmd[y - 1]) {
+ int k = 0, n = y - 1;
+ for (; n >= 0 && '\\' == cmd[n]; n--, k++);
+ if (k % 2) {
+ cmd[y++] = '\\';
+ }
+ }
+
cmd[y++] = '"';
#else
cmd[y++] = '\'';