com php-src: Fix bug #69646 OS command inject ion vulnerability in escapeshellarg: ext/standard/exe c.c

From: Date: Wed, 10 Jun 2015 08:59:13 +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-87172@lists.php.net to get a copy of this message
Commit: e22f22e6ae83298454576f80b1a91373e7a21ce2 Author: Stanislav Malyshev <stas@php.net> Sun, 31 May 2015 22:53:35 -0700 Committer: Julien Pauli <jpauli@php.net> Wed, 10 Jun 2015 10:59:13 +0200 Parents: 58e590aac6839ace470650c58bf418e5fa637eb3 Branches: PHP-5.5.26 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e22f22e6ae83298454576f80b1a91373e7a21ce2 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 6838788..06c0683 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++] = '\'';

« previous php.cvs (#87172) next »