]> granicus.if.org Git - php/commitdiff
Fixed bug #22022 (Crash in imap_mail_compose() if the body is an empty array).
authorIlia Alshanetsky <iliaa@php.net>
Mon, 3 Feb 2003 21:24:32 +0000 (21:24 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 3 Feb 2003 21:24:32 +0000 (21:24 +0000)
ext/imap/php_imap.c

index 41918579fa36f288d66991be06462e99587942b4..944f27a16a57af735eeea8a8294cbf5f58767ce1 100644 (file)
@@ -2807,7 +2807,10 @@ PHP_FUNCTION(imap_mail_compose)
        }
 
        zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body));
-       zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data);
+       if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) != SUCCESS) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter cannot be empty");
+               RETURN_FALSE;
+       }
        zend_hash_get_current_key(Z_ARRVAL_PP(body), &key, &ind, 0); /* FIXME: is this necessary?  we're not using key/ind */
 
        if (Z_TYPE_PP(data) == IS_ARRAY) {