]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix coverity 1493364 & 1493375: unchecked return value
authorPauli <pauli@openssl.org>
Thu, 4 Nov 2021 01:59:55 +0000 (11:59 +1000)
committerPauli <pauli@openssl.org>
Sun, 7 Nov 2021 22:55:32 +0000 (08:55 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16962)

crypto/comp/c_zlib.c

index b36a562d888220be49dc05c40be9c26a585907de..9a7087e444048c476b3cb042feb708565150739e 100644 (file)
@@ -380,7 +380,11 @@ static int bio_zlib_read(BIO *b, char *out, int outl)
             ERR_raise(ERR_LIB_COMP, ERR_R_MALLOC_FAILURE);
             return 0;
         }
-        inflateInit(zin);
+        if ((ret = inflateInit(zin)) != Z_OK) {
+            ERR_raise_data(ERR_LIB_COMP, COMP_R_ZLIB_INFLATE_ERROR,
+                           "zlib error: %s", zError(ret));
+            return 0;
+        }
         zin->next_in = ctx->ibuf;
         zin->avail_in = 0;
     }
@@ -443,7 +447,11 @@ static int bio_zlib_write(BIO *b, const char *in, int inl)
         }
         ctx->optr = ctx->obuf;
         ctx->ocount = 0;
-        deflateInit(zout, ctx->comp_level);
+        if ((ret = deflateInit(zout, ctx->comp_level)) != Z_OK) {
+            ERR_raise_data(ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR,
+                           "zlib error: %s", zError(ret));
+            return 0;
+        }
         zout->next_out = ctx->obuf;
         zout->avail_out = ctx->obufsize;
     }