tony2001                Thu Jan 20 09:18:10 2005 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/imap   php_imap.c 
  Log:
  MFH: fix segfault in imap_headerinfo() when fromlength or subjectlength are 
less than 0
  + fix protos
  
  
http://cvs.php.net/diff.php/php-src/ext/imap/php_imap.c?r1=1.142.2.38&r2=1.142.2.39&ty=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.142.2.38 
php-src/ext/imap/php_imap.c:1.142.2.39
--- php-src/ext/imap/php_imap.c:1.142.2.38      Tue Jan 18 18:36:49 2005
+++ php-src/ext/imap/php_imap.c Thu Jan 20 09:18:10 2005
@@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.142.2.38 2005/01/18 23:36:49 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.142.2.39 2005/01/20 14:18:10 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -1482,11 +1482,19 @@
        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 @@
 }
 /* }}} */
 
-/* {{{ 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 @@
 }
 /* }}} */
 
-/* {{{ 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)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to