adenilson / rpms / zlib

Forked from rpms/zlib 8 months ago
Clone
65fa5e
From 1e56dd1e7285d3026092ba794078edb290b4c1b1 Mon Sep 17 00:00:00 2001
65fa5e
From: Ondrej Dubaj <odubaj@redhat.com>
65fa5e
Date: Mon, 15 Mar 2021 13:06:35 +0100
65fa5e
Subject: [PATCH] fixed isues found by covscan
65fa5e
65fa5e
---
65fa5e
 contrib/minizip/mztools.c | 8 ++++++++
65fa5e
 contrib/minizip/zip.c     | 4 ++--
65fa5e
 deflate.c                 | 5 +++--
65fa5e
 3 files changed, 13 insertions(+), 4 deletions(-)
65fa5e
65fa5e
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c
65fa5e
index 96891c2..1197928 100644
65fa5e
--- a/contrib/minizip/mztools.c
65fa5e
+++ b/contrib/minizip/mztools.c
65fa5e
@@ -286,6 +286,14 @@ uLong* bytesRecovered;
65fa5e
     }
65fa5e
   } else {
65fa5e
     err = Z_STREAM_ERROR;
65fa5e
+    if(fpZip != NULL)
65fa5e
+      fclose(fpZip);
65fa5e
+
65fa5e
+    if(fpOut != NULL)
65fa5e
+      fclose(fpOut);
65fa5e
+
65fa5e
+    if(fpOutCD != NULL)
65fa5e
+      fclose(fpOutCD);
65fa5e
   }
65fa5e
   return err;
65fa5e
 }
65fa5e
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
65fa5e
index 44e88a9..a753c17 100644
65fa5e
--- a/contrib/minizip/zip.c
65fa5e
+++ b/contrib/minizip/zip.c
65fa5e
@@ -526,8 +526,8 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
65fa5e
         break;
65fa5e
       }
65fa5e
 
65fa5e
-      if (uPosFound!=0)
65fa5e
-        break;
65fa5e
+    if (uPosFound!=0)
65fa5e
+      break;
65fa5e
   }
65fa5e
   TRYFREE(buf);
65fa5e
   return uPosFound;
65fa5e
diff --git a/deflate.c b/deflate.c
65fa5e
index 085abbe..3963e79 100644
65fa5e
--- a/deflate.c
65fa5e
+++ b/deflate.c
65fa5e
@@ -203,9 +203,10 @@ local const config configuration_table[10] = {
65fa5e
  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
65fa5e
  * prev[] will be initialized on the fly.
65fa5e
  */
65fa5e
-#define CLEAR_HASH(s) \
65fa5e
+#define CLEAR_HASH(s) do { \
65fa5e
     s->head[s->hash_size-1] = NIL; \
65fa5e
-    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
65fa5e
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
65fa5e
+} while (0)
65fa5e
 
65fa5e
 /* ===========================================================================
65fa5e
  * Slide the hash table when sliding the window down (could be avoided with 32
65fa5e
-- 
65fa5e
2.26.0
65fa5e