com php-src: fix datatype mismatches: ext/standard/exec.c
| From: | Anatol Belski | Date: | Wed, 22 Oct 2014 18:46:33 +0000 |
| Subject: | com php-src: fix datatype mismatches: ext/standard/exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82453@lists.php.net to get a copy of this message | ||
Commit: 0565a29e4dc5426631a38c702f8a517f2a7d65c1
Author: Anatol Belski <ab@php.net> Wed, 22 Oct 2014 20:21:51 +0200
Parents: 58b82272404739fcc2907e68ae8e569c2161ddf2
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0565a29e4dc5426631a38c702f8a517f2a7d65c1
Log:
fix datatype mismatches
Changed paths:
M ext/standard/exec.c
Diff:
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 28f01b3..6106fe2 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -61,7 +61,8 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
{
FILE *fp;
char *buf;
- int l = 0, pclose_return;
+ size_t l = 0;
+ int pclose_return;
char *b, *d=NULL;
php_stream *stream;
size_t buflen, bufl = 0;
@@ -115,8 +116,8 @@ 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]));
- if (l != (int)(bufl - 1)) {
+ while (l >= 1 && l-- && isspace(((unsigned char *)buf)[l]));
+ if (l != (bufl - 1)) {
bufl = l + 1;
buf[bufl] = '\0';
}
@@ -128,8 +129,8 @@ 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]));
- if (l != (int)(bufl - 1)) {
+ while (l >= 1 && l-- && isspace(((unsigned char *)buf)[l]));
+ if (l != (bufl - 1)) {
bufl = l + 1;
buf[bufl] = '\0';
}
@@ -240,7 +241,7 @@ PHP_FUNCTION(passthru)
*/
PHPAPI zend_string *php_escape_shell_cmd(char *str)
{
- register int x, y, l = strlen(str);
+ register int x, y, l = (int)strlen(str);
char *p = NULL;
size_t estimate = (2 * l) + 1;
zend_string *cmd;
@@ -333,7 +334,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
*/
PHPAPI zend_string *php_escape_shell_arg(char *str)
{
- int x, y = 0, l = strlen(str);
+ int x, y = 0, l = (int)strlen(str);
zend_string *cmd;
size_t estimate = (4 * l) + 3;