From e9b08d1631a56b9469d3852b7a5341221f64bdee Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 20 Jan 2005 14:18:10 +0000 Subject: [PATCH] MFH: fix segfault in imap_headerinfo() when fromlength or subjectlength are less than 0 + fix protos --- ext/imap/php_imap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index e5d968f3fb..acd71be78d 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -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) { -- 2.40.0