summaryrefslogtreecommitdiff
path: root/ext/imap
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-04-23 22:25:13 +0000
committerPierre Joye <pajoye@php.net>2009-04-23 22:25:13 +0000
commitc20e1537cf3eb1fd084882e6b002a7b92987df6f (patch)
tree2cda02675e21521b8dc7fdb72cf799d112034c69 /ext/imap
parentb6672146b0b63c0d8ef692d84593b2b8ab882e18 (diff)
downloadphp-git-c20e1537cf3eb1fd084882e6b002a7b92987df6f.tar.gz
- MFH: #47940, leaks in imap_body()
Diffstat (limited to 'ext/imap')
-rw-r--r--ext/imap/php_imap.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 331056d9aa..830f44cf3d 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -1575,6 +1575,8 @@ PHP_FUNCTION(imap_body)
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 @@ PHP_FUNCTION(imap_body)
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);
}
/* }}} */