From 92d3eb31b71a746fad5e49b50071d6e5d46ea3e2 Mon Sep 17 00:00:00 2001 From: Zoe Slattery Date: Tue, 16 Dec 2008 21:10:16 +0000 Subject: [PATCH] bug #46884 fix --- ext/imap/php_imap.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 1c3347fb2f..fd89734e45 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1575,6 +1575,11 @@ PHP_FUNCTION(imap_body) return; } + if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the options parameter"); + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); if ((argc == 3) && (flags & FT_UID)) { @@ -2166,6 +2171,11 @@ PHP_FUNCTION(imap_fetchstructure) if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &streamind, &msgno, &flags) == FAILURE) { return; } + + if (flags && ((flags & ~FT_UID) != 0)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the options parameter"); + RETURN_FALSE; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); @@ -2211,6 +2221,11 @@ PHP_FUNCTION(imap_fetchbody) if (zend_parse_parameters(argc TSRMLS_CC, "rls|l", &streamind, &msgno, &sec, &sec_len, &flags) == FAILURE) { return; } + + if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the options parameter"); + RETURN_FALSE; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); @@ -2930,13 +2945,18 @@ PHP_FUNCTION(imap_sort) PHP_FUNCTION(imap_fetchheader) { zval *streamind; - long msgno, flags; + long msgno, flags=0L; pils *imap_le_struct; int msgindex, argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &streamind, &msgno, &flags) == FAILURE) { return; } + + if (flags && ((flags & ~(FT_UID|FT_INTERNAL|FT_PREFETCHTEXT)) != 0)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the options parameter"); + RETURN_FALSE; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); -- 2.40.0