diff options
author | Antony Dovgal <tony2001@php.net> | 2005-01-20 14:11:36 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2005-01-20 14:11:36 +0000 |
commit | ed4ddfe263f8d6dcc891f922732e3909b1901289 (patch) | |
tree | 25c0695dcbd71bb791aac1b7c96e18e382fc5e00 /ext/imap/php_imap.c | |
parent | 0f3cce53adc9e4793f0fd7332682083ffeeec95f (diff) | |
download | php-git-ed4ddfe263f8d6dcc891f922732e3909b1901289.tar.gz |
MFH: fix segfault in imap_headerinfo() when fromlength or subjectlength are less than 0
+ fix protos
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r-- | ext/imap/php_imap.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 5706e0f5ef..34c51188c1 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1525,12 +1525,20 @@ PHP_FUNCTION(imap_headerinfo) convert_to_long_ex(msgno); if (myargc >= 3) { - convert_to_long_ex(fromlength); + 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; } @@ -1798,7 +1806,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) { @@ -2612,7 +2620,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) { |