summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorVlad Krupin <vlad@php.net>2002-01-12 05:39:07 +0000
committerVlad Krupin <vlad@php.net>2002-01-12 05:39:07 +0000
commit8df03e2814aed732c0fbe3d45143433495533608 (patch)
treeba4c402941fef7034a646334f738604f7e89291b /ext/imap/php_imap.c
parent0b22425be17d64b785a889635b79461060600d5f (diff)
downloadphp-git-8df03e2814aed732c0fbe3d45143433495533608.tar.gz
Fixed segfault in imap_bodystruct() when called with an invalid message
number. Now it fails with a warning instead.
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c5
1 files changed, 5 insertions, 0 deletions
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;
}