]> granicus.if.org Git - php/commitdiff
MFH: fix segfault in imap_headerinfo() when fromlength or subjectlength are less...
authorAntony Dovgal <tony2001@php.net>
Thu, 20 Jan 2005 14:18:10 +0000 (14:18 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 20 Jan 2005 14:18:10 +0000 (14:18 +0000)
+ fix protos

ext/imap/php_imap.c

index e5d968f3fb41e0d48afb5a25a0fc023cb0c3f7ae..acd71be78dae6813c6596cdc98177b5ec790b74b 100644 (file)
@@ -1482,11 +1482,19 @@ 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");
+                       RETURN_FALSE;
+               }
        } else {
                fromlength = 0x00;
        }
        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");
+                       RETURN_FALSE;
+               }
        } else {
                subjectlength = 0x00;
        }
@@ -1757,7 +1765,7 @@ PHP_FUNCTION(imap_fetchstructure)
 }
 /* }}} */
 
-/* {{{ proto string imap_fetchbody(resource stream_id, int msg_no, int section [, int options])
+/* {{{ proto string imap_fetchbody(resource stream_id, int msg_no, string section [, int options])
    Get a specific body section */
 PHP_FUNCTION(imap_fetchbody)
 {
@@ -2581,7 +2589,7 @@ PHP_FUNCTION(imap_status)
 }
 /* }}} */
 
-/* {{{ proto object imap_bodystruct(resource stream_id, int msg_no, int section)
+/* {{{ proto object imap_bodystruct(resource stream_id, int msg_no, string section)
    Read the structure of a specified body section of a specific message */
 PHP_FUNCTION(imap_bodystruct)
 {