]> granicus.if.org Git - php/commitdiff
MFH: fix segfault in imap_sort()
authorAntony Dovgal <tony2001@php.net>
Thu, 20 Jan 2005 18:08:54 +0000 (18:08 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 20 Jan 2005 18:08:54 +0000 (18:08 +0000)
ext/imap/php_imap.c

index 34c51188c1fcd13e0d8be9bc7d9e106ab585d342..c40944acb55f1f75356823502c253abaf6ba1061 100644 (file)
@@ -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);