]> granicus.if.org Git - php/commitdiff
bug #46884 fix
authorZoe Slattery <zoe@php.net>
Tue, 16 Dec 2008 21:08:50 +0000 (21:08 +0000)
committerZoe Slattery <zoe@php.net>
Tue, 16 Dec 2008 21:08:50 +0000 (21:08 +0000)
ext/imap/php_imap.c

index 56a041b2ea7df256796a91ffec2a41043a37c102..d1a9b0baa4f4e99ca035f302684c1cf0810c710e 100644 (file)
@@ -1560,6 +1560,12 @@ 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)) {
@@ -2151,6 +2157,12 @@ 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);
 
@@ -2197,6 +2209,12 @@ PHP_FUNCTION(imap_fetchbody)
                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 < 4 || !(flags & FT_UID)) {
@@ -2915,13 +2933,20 @@ 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);
        
@@ -3159,7 +3184,7 @@ PHP_FUNCTION(imap_fetch_overview)
                return;
        }
 
-       if (flags && ((flags & ~FT_UID) !=0)) { 
+       if (flags && ((flags & ~FT_UID) != 0)) {        
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the options parameter");
                RETURN_FALSE;
        }