]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorStanislav Malyshev <stas@php.net>
Fri, 4 Nov 2016 05:12:23 +0000 (22:12 -0700)
committerStanislav Malyshev <stas@php.net>
Fri, 4 Nov 2016 05:30:46 +0000 (22:30 -0700)
* PHP-5.6:
  Add length check for bzcompress too - fix for bug #73356

1  2 
ext/standard/exec.c

index 7e21bce09809dd36383091caa7379a330e502b30,88a6b4ab791885fe5122313f9a11533bcff60277..18480c3891297e75052fffadf017283fd0e24b3d
@@@ -316,13 -325,13 +316,13 @@@ PHPAPI zend_string *php_escape_shell_cm
                                } else if (p && *p == str[x]) {
                                        p = NULL;
                                } else {
 -                                      cmd[y++] = '\\';
 +                                      ZSTR_VAL(cmd)[y++] = '\\';
                                }
 -                              cmd[y++] = str[x];
 +                              ZSTR_VAL(cmd)[y++] = str[x];
                                break;
  #else
-                       /* % is Windows specific for environmental variables, ^%PATH% will 
 -                      /* % is Windows specific for enviromental variables, ^%PATH% will
 -                              output PATH while ^%PATH^% will not. escapeshellcmd will escape all % and !.
++                      /* % is Windows specific for environmental variables, ^%PATH% will
 +                              output PATH while ^%PATH^% will not. escapeshellcmd->val will escape all % and !.
                        */
                        case '%':
                        case '!':
@@@ -479,11 -488,11 +479,10 @@@ PHP_FUNCTION(escapeshellcmd
  
        if (command_len) {
                if (command_len != strlen(command)) {
 -                      php_error_docref(NULL TSRMLS_CC, E_ERROR, "Input string contains NULL bytes");
 +                      php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes");
                        return;
                }
--              cmd = php_escape_shell_cmd(command);
--              RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0);
++              RETVAL_STR(php_escape_shell_cmd(command));
        } else {
                RETVAL_EMPTY_STRING();
        }
@@@ -503,11 -513,11 +502,10 @@@ PHP_FUNCTION(escapeshellarg
  
        if (argument) {
                if (argument_len != strlen(argument)) {
 -                      php_error_docref(NULL TSRMLS_CC, E_ERROR, "Input string contains NULL bytes");
 +                      php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes");
                        return;
                }
--              cmd = php_escape_shell_arg(argument);
--              RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0);
++              RETVAL_STR(php_escape_shell_arg(argument));
        }
  }
  /* }}} */
@@@ -536,11 -547,11 +534,11 @@@ PHP_FUNCTION(shell_exec
        }
  
        stream = php_stream_fopen_from_pipe(in, "rb");
 -      total_readbytes = php_stream_copy_to_mem(stream, &ret, PHP_STREAM_COPY_ALL, 0);
 +      ret = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0);
        php_stream_close(stream);
  
--      if (total_readbytes > 0) {
--              RETVAL_STRINGL_CHECK(ret, total_readbytes, 0);
++      if (ret && ZSTR_LEN(ret) > 0) {
++              RETVAL_STR(ret);
        }
  }
  /* }}} */