From: miod Date: Sun, 18 May 2014 16:18:13 +0000 (+0000) Subject: In OCSP_sendreq_bio(), cope with OCSP_sendreq_new() returning NULL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a0f5415429c64f969c4469037ad639ad1cf29ae6;p=openbsd In OCSP_sendreq_bio(), cope with OCSP_sendreq_new() returning NULL. ok jsing@ --- diff --git a/lib/libcrypto/ocsp/ocsp_ht.c b/lib/libcrypto/ocsp/ocsp_ht.c index f3ee29ccbb0..3e7c2e46d00 100644 --- a/lib/libcrypto/ocsp/ocsp_ht.c +++ b/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/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/lib/libssl/src/crypto/ocsp/ocsp_ht.c index f3ee29ccbb0..3e7c2e46d00 100644 --- a/lib/libssl/src/crypto/ocsp/ocsp_ht.c +++ b/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);