summaryrefslogtreecommitdiff
path: root/ext/standard/exec.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-22 20:21:51 +0200
committerAnatol Belski <ab@php.net>2014-10-22 20:46:33 +0200
commit0565a29e4dc5426631a38c702f8a517f2a7d65c1 (patch)
tree3231b97bf0188a43a5e092f77b3bcf8ceebd15ae /ext/standard/exec.c
parent58b82272404739fcc2907e68ae8e569c2161ddf2 (diff)
downloadphp-git-0565a29e4dc5426631a38c702f8a517f2a7d65c1.tar.gz
fix datatype mismatches
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r--ext/standard/exec.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 28f01b338f..6106fe2c86 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;