summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormiod <>2014-05-18 16:18:13 +0000
committermiod <>2014-05-18 16:18:13 +0000
commitb5d9cd2255a7e97b93cadef1883c8699dce9d72b (patch)
treeb550db31967b3de58fe699bba2a1f7e240fb2e1f /src/lib
parent43c6337e7ac91091d8735e4fae024d0b71db52eb (diff)
downloadopenbsd-b5d9cd2255a7e97b93cadef1883c8699dce9d72b.tar.gz
openbsd-b5d9cd2255a7e97b93cadef1883c8699dce9d72b.tar.bz2
openbsd-b5d9cd2255a7e97b93cadef1883c8699dce9d72b.zip
In OCSP_sendreq_bio(), cope with OCSP_sendreq_new() returning NULL.
ok jsing@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_ht.c10
-rw-r--r--src/lib/libssl/src/crypto/ocsp/ocsp_ht.c10
2 files changed, 12 insertions, 8 deletions
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)
161 161
162 rctx = malloc(sizeof(OCSP_REQ_CTX)); 162 rctx = malloc(sizeof(OCSP_REQ_CTX));
163 if (rctx == NULL) 163 if (rctx == NULL)
164 return 0; 164 return NULL;
165 rctx->state = OHS_ERROR; 165 rctx->state = OHS_ERROR;
166 rctx->mem = BIO_new(BIO_s_mem()); 166 rctx->mem = BIO_new(BIO_s_mem());
167 rctx->io = io; 167 rctx->io = io;
@@ -174,7 +174,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
174 if (!rctx->iobuf) { 174 if (!rctx->iobuf) {
175 BIO_free(rctx->mem); 175 BIO_free(rctx->mem);
176 free(rctx); 176 free(rctx);
177 return 0; 177 return NULL;
178 } 178 }
179 if (!path) 179 if (!path)
180 path = "/"; 180 path = "/";
@@ -183,14 +183,14 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
183 free(rctx->iobuf); 183 free(rctx->iobuf);
184 BIO_free(rctx->mem); 184 BIO_free(rctx->mem);
185 free(rctx); 185 free(rctx);
186 return 0; 186 return NULL;
187 } 187 }
188 188
189 if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) { 189 if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) {
190 free(rctx->iobuf); 190 free(rctx->iobuf);
191 BIO_free(rctx->mem); 191 BIO_free(rctx->mem);
192 free(rctx); 192 free(rctx);
193 return 0; 193 return NULL;
194 } 194 }
195 195
196 return rctx; 196 return rctx;
@@ -453,6 +453,8 @@ OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req)
453 int rv; 453 int rv;
454 454
455 ctx = OCSP_sendreq_new(b, path, req, -1); 455 ctx = OCSP_sendreq_new(b, path, req, -1);
456 if (ctx == NULL)
457 return NULL;
456 458
457 do { 459 do {
458 rv = OCSP_sendreq_nbio(&resp, ctx); 460 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)
161 161
162 rctx = malloc(sizeof(OCSP_REQ_CTX)); 162 rctx = malloc(sizeof(OCSP_REQ_CTX));
163 if (rctx == NULL) 163 if (rctx == NULL)
164 return 0; 164 return NULL;
165 rctx->state = OHS_ERROR; 165 rctx->state = OHS_ERROR;
166 rctx->mem = BIO_new(BIO_s_mem()); 166 rctx->mem = BIO_new(BIO_s_mem());
167 rctx->io = io; 167 rctx->io = io;
@@ -174,7 +174,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
174 if (!rctx->iobuf) { 174 if (!rctx->iobuf) {
175 BIO_free(rctx->mem); 175 BIO_free(rctx->mem);
176 free(rctx); 176 free(rctx);
177 return 0; 177 return NULL;
178 } 178 }
179 if (!path) 179 if (!path)
180 path = "/"; 180 path = "/";
@@ -183,14 +183,14 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
183 free(rctx->iobuf); 183 free(rctx->iobuf);
184 BIO_free(rctx->mem); 184 BIO_free(rctx->mem);
185 free(rctx); 185 free(rctx);
186 return 0; 186 return NULL;
187 } 187 }
188 188
189 if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) { 189 if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) {
190 free(rctx->iobuf); 190 free(rctx->iobuf);
191 BIO_free(rctx->mem); 191 BIO_free(rctx->mem);
192 free(rctx); 192 free(rctx);
193 return 0; 193 return NULL;
194 } 194 }
195 195
196 return rctx; 196 return rctx;
@@ -453,6 +453,8 @@ OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req)
453 int rv; 453 int rv;
454 454
455 ctx = OCSP_sendreq_new(b, path, req, -1); 455 ctx = OCSP_sendreq_new(b, path, req, -1);
456 if (ctx == NULL)
457 return NULL;
456 458
457 do { 459 do {
458 rv = OCSP_sendreq_nbio(&resp, ctx); 460 rv = OCSP_sendreq_nbio(&resp, ctx);