com php-src: Fixed invalid read: ext/standard/exec.c

From: Date: Wed, 08 Jul 2015 11:19:37 +0000
Subject: com php-src: Fixed invalid read: ext/standard/exec.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87847@lists.php.net to get a copy of this message
Commit: 94957a7091d2d87d3b75c8395a3a11a4fbecaea1 Author: Xinchen Hui <laruence@php.net> Wed, 8 Jul 2015 19:06:49 +0800 Parents: ca30d5bf3947922a618d95f1ae16886204f37292 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=94957a7091d2d87d3b75c8395a3a11a4fbecaea1 Log: Fixed invalid read Changed paths: M ext/standard/exec.c Diff: diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 66d4537..4764f4b 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -115,7 +115,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ } else if (type == 2) { /* strip trailing whitespaces */ l = bufl; - while (l-- && isspace(((unsigned char *)buf)[l])); + while (--l >= 0 && isspace(((unsigned char *)buf)[l])); if (l != (int)(bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; @@ -128,7 +128,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ /* strip trailing whitespaces if we have not done so already */ if ((type == 2 && buf != b) || type != 2) { l = bufl; - while (l-- && isspace(((unsigned char *)buf)[l])); + while (--l >= 0 && isspace(((unsigned char *)buf)[l])); if (l != (int)(bufl - 1)) { bufl = l + 1; buf[bufl] = '\0';

« previous php.cvs (#87847) next »