com php-src: Fixed bug #72463 mail fails with invalid argument: ext/pcre/php_pcre.c ext/pcre/tests/bug72463.p hpt
| From: | Anatol Belski | Date: | Wed, 22 Jun 2016 17:06:33 +0000 |
| Subject: | com php-src: Fixed bug #72463 mail fails with invalid argument: ext/pcre/php_pcre.c ext/pcre/tests/bug72463.p hpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92614@lists.php.net to get a copy of this message | ||
Commit: e4539042516f337435c07a6e207eb5178e199d9a
Author: Anatol Belski <ab@php.net> Wed, 22 Jun 2016 19:05:31 +0200
Parents: 3c84e5e1ceff8b7a17c3047c5ade822067a55a70
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e4539042516f337435c07a6e207eb5178e199d9a
Log:
Fixed bug #72463 mail fails with invalid argument
Bugs:
https://bugs.php.net/72463
Changed paths:
M ext/pcre/php_pcre.c
A ext/pcre/tests/bug72463.phpt
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index ed0f3b3...356b5dc 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1331,7 +1331,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string
*su
break;
}
new_len = result_len + subject_len - start_offset;
- if (new_len > alloc_len) {
+ if (new_len >= alloc_len) {
alloc_len = new_len; /* now we know exactly how long it is */
if (NULL != result) {
result = zend_string_realloc(result, alloc_len, 0);
diff --git a/ext/pcre/tests/bug72463.phpt b/ext/pcre/tests/bug72463.phpt
new file mode 100644
index 0000000..c164616
--- /dev/null
+++ b/ext/pcre/tests/bug72463.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #72463 mail fails with invalid argument
+--FILE--
+<?php
+
+@mail("some.address.it.wont.ever.reach@lookup.and.try.to.find.this.host.name","subject","a",
"");
+@mail("some.address.it.wont.ever.reach@lookup.and.try.to.find.this.host.name","subject","a",
NULL);
+
+?>
+===DONE===
+--EXPECTF--
+===DONE===