From: Giovanni Bechis Date: Tue, 1 Feb 2022 15:00:20 +0000 (+0000) Subject: check BIO_new(3) return values X-Git-Tag: 2.5.0-alpha2-ci-test-only~524 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a521a5832f97f82204a3233c1f7645293862f19;p=thirdparty%2Fapache%2Fhttpd.git check BIO_new(3) return values git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897662 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/ab.c b/support/ab.c index 84d27d26496..20de3a844ce 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1420,7 +1420,11 @@ static void start_connect(struct connection * c) } ssl_rand_seed(); apr_os_sock_get(&fd, c->aprsock); - bio = BIO_new_socket(fd, BIO_NOCLOSE); + if((bio = BIO_new_socket(fd, BIO_NOCLOSE)) == NULL) { + BIO_printf(bio_err, "BIO_new_socket failed.\n"); + ERR_print_errors(bio_err); + exit(1); + } BIO_set_nbio(bio, 1); SSL_set_bio(c->ssl, bio, bio); SSL_set_connect_state(c->ssl); @@ -2679,8 +2683,14 @@ int main(int argc, const char * const argv[]) #endif SSL_load_error_strings(); SSL_library_init(); - bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); - bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); + if(!(bio_out = BIO_new_fp(stdout,BIO_NOCLOSE))) { + fprintf(stderr, "%s: Cannot allocate memory", argv[0]); + exit(1); + } + if(!(bio_err = BIO_new_fp(stderr,BIO_NOCLOSE))) { + fprintf(stderr, "%s: Cannot allocate memory", argv[0]); + exit(1); + } #if OPENSSL_VERSION_NUMBER >= 0x10101000 if (RAND_status() == 0) {