pajoye          Thu Apr 23 22:25:13 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/imap   php_imap.c 
  Log:
  - MFH: #47940,  leaks in imap_body()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.26.2.31&r2=1.208.2.7.2.26.2.32&diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.31 
php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.32
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.31     Thu Jan  8 16:13:51 2009
+++ php-src/ext/imap/php_imap.c Thu Apr 23 22:25:13 2009
@@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <z...@zend.com>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.26.2.31 2009/01/08 16:13:51 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.26.2.32 2009/04/23 22:25:13 pajoye Exp $ */
 
 #define IMAP41
 
@@ -1575,6 +1575,8 @@
        long msgno, flags = 0;
        pils *imap_le_struct; 
        int msgindex, argc = ZEND_NUM_ARGS();
+       char *body;
+       unsigned long body_len = 0;
 
        if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &streamind, &msgno, 
&flags) == FAILURE) {
                return;
@@ -1600,7 +1602,13 @@
                RETURN_FALSE;
        }
 
-       RETVAL_STRING(mail_fetchtext_full(imap_le_struct->imap_stream, msgno, 
NIL, (argc == 3 ? flags : NIL)), 1);
+       body = mail_fetchtext_full (imap_le_struct->imap_stream, msgno, 
&body_len, (argc == 3 ? flags : NIL));
+       if (body_len == 0) {
+               RETVAL_EMPTY_STRING();
+       } else {
+               RETVAL_STRINGL(body, body_len, 1);
+       }
+       free(body);
 }
 /* }}} */
 



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

Reply via email to