From 8df03e2814aed732c0fbe3d45143433495533608 Mon Sep 17 00:00:00 2001 From: Vlad Krupin Date: Sat, 12 Jan 2002 05:39:07 +0000 Subject: [PATCH] Fixed segfault in imap_bodystruct() when called with an invalid message number. Now it fails with a warning instead. --- ext/imap/php_imap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 6b7de31ab3..cb26d7f644 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -2690,6 +2690,11 @@ PHP_FUNCTION(imap_bodystruct) convert_to_long_ex(msg); convert_to_string_ex(section); + if (!Z_LVAL_PP(msg) || Z_LVAL_PP(msg) < 1 || (unsigned) Z_LVAL_PP(msg) > imap_le_struct->imap_stream->nmsgs) { + php_error(E_WARNING, "Bad message number"); + RETURN_FALSE; + } + if (object_init(return_value) == FAILURE) { RETURN_FALSE; } -- 2.50.1