diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2008-04-02 16:31:51 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2008-04-02 16:31:51 +0000 |
| commit | 357cadb3621817193d441f01365dfdbb58a661a5 (patch) | |
| tree | e64c72d4c9dd29eac39e31f2396a3b6caaf72826 /ext/imap/php_imap.c | |
| parent | 8f16e0b75c37e5977ed0a41caf700de5bd81289f (diff) | |
| download | php-git-357cadb3621817193d441f01365dfdbb58a661a5.tar.gz | |
MFB: imap bug fixes
Diffstat (limited to 'ext/imap/php_imap.c')
| -rw-r--r-- | ext/imap/php_imap.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 3d6f3c6c8f..9fe4f4cbd9 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -792,7 +792,11 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) #ifdef SET_MAXLOGINTRIALS if (myargc == 5) { convert_to_long_ex(retries); - mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) Z_LVAL_PP(retries)); + if (retries < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING ,"Retries must be greater or equal to 0"); + } else { + mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) Z_LVAL_PP(retries)); + } } #endif @@ -1583,8 +1587,8 @@ PHP_FUNCTION(imap_headerinfo) convert_to_long_ex(msgno); if (myargc >= 3) { convert_to_long_ex(fromlength); - if (Z_LVAL_PP(fromlength) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "From length has to be greater than or equal to 0"); + if (Z_LVAL_PP(fromlength) < 0 || Z_LVAL_PP(fromlength) >= MAILTMPLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "From length has to be between 1 and %i", MAILTMPLEN); RETURN_FALSE; } } else { @@ -1592,8 +1596,8 @@ PHP_FUNCTION(imap_headerinfo) } if (myargc >= 4) { 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"); + if (Z_LVAL_PP(subjectlength) < 0 || Z_LVAL_PP(subjectlength) >= MAILTMPLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject length has to be between 1 and %i", MAILTMPLEN); RETURN_FALSE; } } else { |
