summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2005-01-20 18:03:35 +0000
committerAntony Dovgal <tony2001@php.net>2005-01-20 18:03:35 +0000
commit4f3e113e38943945f6f585f1ba565c7db74ebec1 (patch)
tree370804192b3dc6a7565783925bfb4c49d3a6591b /ext/imap/php_imap.c
parent844cc09cd1919753519537966750064790be0321 (diff)
downloadphp-git-4f3e113e38943945f6f585f1ba565c7db74ebec1.tar.gz
fix segfault in imap_sort() - it segfaults when options is less than 0.
it looks like c-client bug, but we still need a workaround. also, convert_to_string search criteria.
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index b243fb37a1..b90ac50f24 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -1537,7 +1537,7 @@ PHP_FUNCTION(imap_headerinfo)
convert_to_long_ex(subjectlength);
if (Z_LVAL_PP(subjectlength) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject length has to be greater than or equal to 0");
- RETURN_FALSE;
+ RETURN_FALSE;
}
} else {
subjectlength = 0x00;
@@ -2467,8 +2467,13 @@ PHP_FUNCTION(imap_sort)
}
if (myargc >= 4) {
convert_to_long_ex(flags);
+ if (Z_LVAL_PP(flags) < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Search options parameter has to be greater than or equal to 0cannot be less than 0");
+ RETURN_FALSE;
+ }
}
if (myargc >= 5) {
+ convert_to_string_ex(criteria);
search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria));
spg = mail_criteria(search_criteria);
efree(search_criteria);