pajoye          Thu Apr 23 22:24:54 2009 UTC

  Modified files:              
    /php-src/ext/imap   php_imap.c 
  Log:
  - #47940,  leaks in imap_body()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.272&r2=1.273&diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.272 php-src/ext/imap/php_imap.c:1.273
--- php-src/ext/imap/php_imap.c:1.272   Tue Mar 10 23:39:22 2009
+++ php-src/ext/imap/php_imap.c Thu Apr 23 22:24:54 2009
@@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <z...@zend.com>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.272 2009/03/10 23:39:22 helly Exp $ */
+/* $Id: php_imap.c,v 1.273 2009/04/23 22:24:54 pajoye Exp $ */
 
 #define IMAP41
 
@@ -1560,6 +1560,8 @@
        long msgno, flags = 0;
        pils *imap_le_struct; 
        int msgindex, argc = ZEND_NUM_ARGS();
+       char *body;
+       unsigned long body_len;
 
        if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &streamind, &msgno, 
&flags) == FAILURE) {
                return;
@@ -1586,7 +1588,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