]> granicus.if.org Git - php/commitdiff
check body for NULL before using and prevent segfaults
authorAntony Dovgal <tony2001@php.net>
Tue, 25 Jan 2005 14:20:02 +0000 (14:20 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 25 Jan 2005 14:20:02 +0000 (14:20 +0000)
ext/imap/php_imap.c

index dfcc790fe4c3080fc42fff370dcff7eb48c29fd2..f900c9b03cb801289a5f28cb0c659cb7682554b3 100644 (file)
@@ -2653,6 +2653,10 @@ PHP_FUNCTION(imap_bodystruct)
        object_init(return_value);
        
        body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg), Z_STRVAL_PP(section));
+       if (body == NULL) {
+               zval_dtor(return_value);
+               RETURN_FALSE;
+       }
        if (body->type <= TYPEMAX) {
                add_property_long(return_value, "type", body->type);
        }