From b5d9cd2255a7e97b93cadef1883c8699dce9d72b Mon Sep 17 00:00:00 2001 From: miod <> Date: Sun, 18 May 2014 16:18:13 +0000 Subject: In OCSP_sendreq_bio(), cope with OCSP_sendreq_new() returning NULL. ok jsing@ --- src/lib/libcrypto/ocsp/ocsp_ht.c | 10 ++++++---- src/lib/libssl/src/crypto/ocsp/ocsp_ht.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index f3ee29ccbb..3e7c2e46d0 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c @@ -161,7 +161,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) rctx = malloc(sizeof(OCSP_REQ_CTX)); if (rctx == NULL) - return 0; + return NULL; rctx->state = OHS_ERROR; rctx->mem = BIO_new(BIO_s_mem()); rctx->io = io; @@ -174,7 +174,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) if (!rctx->iobuf) { BIO_free(rctx->mem); free(rctx); - return 0; + return NULL; } if (!path) path = "/"; @@ -183,14 +183,14 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) free(rctx->iobuf); BIO_free(rctx->mem); free(rctx); - return 0; + return NULL; } if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) { free(rctx->iobuf); BIO_free(rctx->mem); free(rctx); - return 0; + return NULL; } return rctx; @@ -453,6 +453,8 @@ OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req) int rv; ctx = OCSP_sendreq_new(b, path, req, -1); + if (ctx == NULL) + return NULL; do { rv = OCSP_sendreq_nbio(&resp, ctx); diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c index f3ee29ccbb..3e7c2e46d0 100644 --- a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c +++ b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c @@ -161,7 +161,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) rctx = malloc(sizeof(OCSP_REQ_CTX)); if (rctx == NULL) - return 0; + return NULL; rctx->state = OHS_ERROR; rctx->mem = BIO_new(BIO_s_mem()); rctx->io = io; @@ -174,7 +174,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) if (!rctx->iobuf) { BIO_free(rctx->mem); free(rctx); - return 0; + return NULL; } if (!path) path = "/"; @@ -183,14 +183,14 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) free(rctx->iobuf); BIO_free(rctx->mem); free(rctx); - return 0; + return NULL; } if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) { free(rctx->iobuf); BIO_free(rctx->mem); free(rctx); - return 0; + return NULL; } return rctx; @@ -453,6 +453,8 @@ OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req) int rv; ctx = OCSP_sendreq_new(b, path, req, -1); + if (ctx == NULL) + return NULL; do { rv = OCSP_sendreq_nbio(&resp, ctx); -- cgit v1.2.3-55-g6feb