diff options
| author | beck <> | 2017-01-29 17:49:23 +0000 |
|---|---|---|
| committer | beck <> | 2017-01-29 17:49:23 +0000 |
| commit | d1f47bd292f36094480caa49ada36b99a69c59b0 (patch) | |
| tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/comp/c_zlib.c | |
| parent | f8c627888330b75c2eea8a3c27d0efe947a4f9da (diff) | |
| download | openbsd-d1f47bd292f36094480caa49ada36b99a69c59b0.tar.gz openbsd-d1f47bd292f36094480caa49ada36b99a69c59b0.tar.bz2 openbsd-d1f47bd292f36094480caa49ada36b99a69c59b0.zip | |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/comp/c_zlib.c')
| -rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index d9a3359313..1802cffd99 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: c_zlib.c,v 1.18 2015/12/23 20:37:23 mmcc Exp $ */ | 1 | /* $OpenBSD: c_zlib.c,v 1.19 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | #include <stdio.h> | 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
| 4 | #include <string.h> | 4 | #include <string.h> |
| @@ -257,7 +257,7 @@ bio_zlib_new(BIO *bi) | |||
| 257 | 257 | ||
| 258 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); | 258 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); |
| 259 | if (!ctx) { | 259 | if (!ctx) { |
| 260 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); | 260 | COMPerror(ERR_R_MALLOC_FAILURE); |
| 261 | return 0; | 261 | return 0; |
| 262 | } | 262 | } |
| 263 | ctx->ibuf = NULL; | 263 | ctx->ibuf = NULL; |
| @@ -324,7 +324,7 @@ bio_zlib_read(BIO *b, char *out, int outl) | |||
| 324 | if (!ctx->ibuf) { | 324 | if (!ctx->ibuf) { |
| 325 | ctx->ibuf = malloc(ctx->ibufsize); | 325 | ctx->ibuf = malloc(ctx->ibufsize); |
| 326 | if (!ctx->ibuf) { | 326 | if (!ctx->ibuf) { |
| 327 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); | 327 | COMPerror(ERR_R_MALLOC_FAILURE); |
| 328 | return 0; | 328 | return 0; |
| 329 | } | 329 | } |
| 330 | inflateInit(zin); | 330 | inflateInit(zin); |
| @@ -340,8 +340,7 @@ bio_zlib_read(BIO *b, char *out, int outl) | |||
| 340 | while (zin->avail_in) { | 340 | while (zin->avail_in) { |
| 341 | ret = inflate(zin, 0); | 341 | ret = inflate(zin, 0); |
| 342 | if ((ret != Z_OK) && (ret != Z_STREAM_END)) { | 342 | if ((ret != Z_OK) && (ret != Z_STREAM_END)) { |
| 343 | COMPerr(COMP_F_BIO_ZLIB_READ, | 343 | COMPerror(COMP_R_ZLIB_INFLATE_ERROR); |
| 344 | COMP_R_ZLIB_INFLATE_ERROR); | ||
| 345 | ERR_asprintf_error_data("zlib error:%s", | 344 | ERR_asprintf_error_data("zlib error:%s", |
| 346 | zError(ret)); | 345 | zError(ret)); |
| 347 | return 0; | 346 | return 0; |
| @@ -386,7 +385,7 @@ bio_zlib_write(BIO *b, const char *in, int inl) | |||
| 386 | ctx->obuf = malloc(ctx->obufsize); | 385 | ctx->obuf = malloc(ctx->obufsize); |
| 387 | /* Need error here */ | 386 | /* Need error here */ |
| 388 | if (!ctx->obuf) { | 387 | if (!ctx->obuf) { |
| 389 | COMPerr(COMP_F_BIO_ZLIB_WRITE, ERR_R_MALLOC_FAILURE); | 388 | COMPerror(ERR_R_MALLOC_FAILURE); |
| 390 | return 0; | 389 | return 0; |
| 391 | } | 390 | } |
| 392 | ctx->optr = ctx->obuf; | 391 | ctx->optr = ctx->obuf; |
| @@ -427,8 +426,7 @@ bio_zlib_write(BIO *b, const char *in, int inl) | |||
| 427 | /* Compress some more */ | 426 | /* Compress some more */ |
| 428 | ret = deflate(zout, 0); | 427 | ret = deflate(zout, 0); |
| 429 | if (ret != Z_OK) { | 428 | if (ret != Z_OK) { |
| 430 | COMPerr(COMP_F_BIO_ZLIB_WRITE, | 429 | COMPerror(COMP_R_ZLIB_DEFLATE_ERROR); |
| 431 | COMP_R_ZLIB_DEFLATE_ERROR); | ||
| 432 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); | 430 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); |
| 433 | return 0; | 431 | return 0; |
| 434 | } | 432 | } |
| @@ -477,8 +475,7 @@ bio_zlib_flush(BIO *b) | |||
| 477 | if (ret == Z_STREAM_END) | 475 | if (ret == Z_STREAM_END) |
| 478 | ctx->odone = 1; | 476 | ctx->odone = 1; |
| 479 | else if (ret != Z_OK) { | 477 | else if (ret != Z_OK) { |
| 480 | COMPerr(COMP_F_BIO_ZLIB_FLUSH, | 478 | COMPerror(COMP_R_ZLIB_DEFLATE_ERROR); |
| 481 | COMP_R_ZLIB_DEFLATE_ERROR); | ||
| 482 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); | 479 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); |
| 483 | return 0; | 480 | return 0; |
| 484 | } | 481 | } |
