summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Bechis <gbechis@apache.org>2022-02-01 16:00:20 +0100
committerGiovanni Bechis <gbechis@apache.org>2022-02-01 16:00:20 +0100
commit8a521a5832f97f82204a3233c1f7645293862f19 (patch)
treebf9c167136e521617ce3d7b6fe4a0794e062ced5
parentap_regex: Follow up to r1897240: Fetch the ovector _after_ the match. (diff)
downloadapache2-8a521a5832f97f82204a3233c1f7645293862f19.tar.xz
apache2-8a521a5832f97f82204a3233c1f7645293862f19.zip
check BIO_new(3) return values
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897662 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--support/ab.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/support/ab.c b/support/ab.c
index 84d27d2649..20de3a844c 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) {