Skip to content

Commit c75d245

Browse files
committed
Revert "Fixed invalid read"
I must be confused while switching from master to 5.6 This reverts commit 94957a7.
1 parent 94957a7 commit c75d245

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
115115
} else if (type == 2) {
116116
/* strip trailing whitespaces */
117117
l = bufl;
118-
while (--l >= 0 && isspace(((unsigned char *)buf)[l]));
118+
while (l-- && isspace(((unsigned char *)buf)[l]));
119119
if (l != (int)(bufl - 1)) {
120120
bufl = l + 1;
121121
buf[bufl] = '\0';
@@ -128,7 +128,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
128128
/* strip trailing whitespaces if we have not done so already */
129129
if ((type == 2 && buf != b) || type != 2) {
130130
l = bufl;
131-
while (--l >= 0 && isspace(((unsigned char *)buf)[l]));
131+
while (l-- && isspace(((unsigned char *)buf)[l]));
132132
if (l != (int)(bufl - 1)) {
133133
bufl = l + 1;
134134
buf[bufl] = '\0';

0 commit comments

Comments
 (0)