diff options
author | Anatol Belski <ab@php.net> | 2018-01-12 17:14:19 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-01-12 17:14:19 +0100 |
commit | 1d05750c5091e1879ea3b4c95d4ce139b74f843f (patch) | |
tree | 79bd6248f89749627a0db382ff9fe637bd9e6a37 /ext/imap/php_imap.c | |
parent | baaf73be69623ee603adb041bbfb082dcf0976f6 (diff) | |
parent | cecf734dc38449590ae689aed781f4cb7ade61be (diff) | |
download | php-git-1d05750c5091e1879ea3b4c95d4ce139b74f843f.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fixed bug #75774 imap_append HeapCorruction
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r-- | ext/imap/php_imap.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 6b5d760153..4f5cefdbb4 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; } |