diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-09-30 11:46:06 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-09-30 11:49:51 +0200 |
commit | 6656d32eb36e6d3ea21d10ebd15a4da6fc7d078b (patch) | |
tree | 408d441ff125738eff761ed66ecaa77d715a2720 | |
parent | 68da84875ef4dd1aa5dacf2ab43db5b88e30d1f7 (diff) | |
parent | dd937129113fb0cc435c579e8308218d119d9726 (diff) | |
download | php-git-6656d32eb36e6d3ea21d10ebd15a4da6fc7d078b.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/standard/exec.c | 4 | ||||
-rw-r--r-- | ext/standard/tests/mail/bug73203.phpt | 24 |
3 files changed, 29 insertions, 2 deletions
@@ -57,6 +57,9 @@ PHP NEWS . Fixed bug #73100 (session_destroy null dereference in ps_files_path_create). (cmb) +- Standard: + . Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb) + 15 Sep 2016, PHP 7.1.0RC2 - Core: diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 6436a29278..bf9100b0d2 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -363,7 +363,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str) } ZSTR_VAL(cmd)[y] = '\0'; - if (y - 1 > cmd_max_len) { + if (y > cmd_max_len + 1) { php_error_docref(NULL, E_ERROR, "Escaped command exceeds the allowed length of %d bytes", cmd_max_len); zend_string_release(cmd); return ZSTR_EMPTY_ALLOC(); @@ -450,7 +450,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str) #endif ZSTR_VAL(cmd)[y] = '\0'; - if (y - 1 > cmd_max_len) { + if (y > cmd_max_len + 1) { php_error_docref(NULL, E_ERROR, "Escaped argument exceeds the allowed length of %d bytes", cmd_max_len); zend_string_release(cmd); return ZSTR_EMPTY_ALLOC(); diff --git a/ext/standard/tests/mail/bug73203.phpt b/ext/standard/tests/mail/bug73203.phpt new file mode 100644 index 0000000000..6b3bf6618c --- /dev/null +++ b/ext/standard/tests/mail/bug73203.phpt @@ -0,0 +1,24 @@ +--TEST--
+Bug #73203 (passing additional_parameters causes mail to fail)
+--DESCRIPTION--
+We're not really interested in testing mail() here, but it is currently the
+only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
+with an empty string. Therefore we don't check the resulting email, but only
+verify that the call succeeds.
+--INI--
+sendmail_path=cat >/dev/null
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
+?>
+--FILE--
+<?php
+var_dump(
+ mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+===DONE===
|