summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-01-12 17:14:46 +0100
committerAnatol Belski <ab@php.net>2018-01-12 17:14:46 +0100
commit4121f2a1adc9ea486ed3a71409e1120ccedecc1b (patch)
tree00402c9524c2e47175c771775d73a3626adc4ac6 /ext/imap/php_imap.c
parent7892eaf07593f198ef0d6d1cd0c2a57e8db19544 (diff)
parent1d05750c5091e1879ea3b4c95d4ce139b74f843f (diff)
downloadphp-git-4121f2a1adc9ea486ed3a71409e1120ccedecc1b.tar.gz
Merge branch 'PHP-7.2'
* PHP-7.2: Fixed bug #75774 imap_append HeapCorruction
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 36468e2d13..caeb28b900 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -1312,18 +1312,18 @@ PHP_FUNCTION(imap_append)
zend_string *folder, *message, *internal_date = NULL, *flags = NULL;
pils *imap_le_struct;
STRING st;
- zend_string* regex;
- pcre_cache_entry *pce; /* Compiled regex */
- zval *subpats = NULL; /* Parts (not used) */
- int global = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS|SS", &streamind, &folder, &message, &flags, &internal_date) == FAILURE) {
return;
}
- regex = zend_string_init("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/", sizeof("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/") - 1, 0);
if (internal_date) {
+ zend_string *regex = zend_string_init("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/", sizeof("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/") - 1, 0);
+ pcre_cache_entry *pce; /* Compiled regex */
+ zval *subpats = NULL; /* Parts (not used) */
+ int global = 0;
+
/* Make sure the given internal_date string matches the RFC specifiedformat */
if ((pce = pcre_get_compiled_regex_cache(regex))== NULL) {
zend_string_free(regex);
@@ -1340,7 +1340,6 @@ PHP_FUNCTION(imap_append)
}
}
- zend_string_free(regex);
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
RETURN_FALSE;
}