Blame SOURCES/CVE-2020-18442.patch

f76a33
From ac9ae39ef419e9f0f83da1e583314d8c7cda34a6 Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:48:45 +0100
f76a33
Subject: [PATCH 1/7] #68 ssize_t return value of zzip_file_read is a signed
f76a33
 value being possibly -1
f76a33
f76a33
---
f76a33
 bins/unzzipcat-zip.c | 2 +-
f76a33
 1 file changed, 1 insertion(+), 1 deletion(-)
f76a33
f76a33
diff --git a/bins/unzzipcat-zip.c b/bins/unzzipcat-zip.c
f76a33
index dd78c2b..385aeaf 100644
f76a33
--- a/bins/unzzipcat-zip.c
f76a33
+++ b/bins/unzzipcat-zip.c
f76a33
@@ -34,7 +34,7 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_file_read (file, buffer, 1024))) 
f76a33
+	while (0 < (len = zzip_file_read (file, buffer, 1024))) 
f76a33
 	{
f76a33
 	    fwrite (buffer, 1, len, out);
f76a33
 	}
f76a33
-- 
f76a33
2.32.0
f76a33
f76a33
f76a33
From 7e786544084548da7fcfcd9090d3c4e7f5777f7e Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:50:26 +0100
f76a33
Subject: [PATCH 2/7] #68 return value of zzip_mem_disk_fread is signed
f76a33
f76a33
---
f76a33
 bins/unzip-mem.c | 4 ++--
f76a33
 1 file changed, 2 insertions(+), 2 deletions(-)
f76a33
f76a33
diff --git a/bins/unzip-mem.c b/bins/unzip-mem.c
f76a33
index cc009f8..50eb5a6 100644
f76a33
--- a/bins/unzip-mem.c
f76a33
+++ b/bins/unzip-mem.c
f76a33
@@ -81,7 +81,7 @@ static void zzip_mem_entry_pipe(ZZIP_MEM_DISK* disk,
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_mem_disk_fread (buffer, 1024, 1, file)))
f76a33
+	while (0 < (len = zzip_mem_disk_fread (buffer, 1024, 1, file)))
f76a33
 	    fwrite (buffer, len, 1, out);
f76a33
 	
f76a33
 	zzip_mem_disk_fclose (file);
f76a33
@@ -115,7 +115,7 @@ static void zzip_mem_entry_test(ZZIP_MEM_DISK* disk,
f76a33
     {
f76a33
 	unsigned long crc = crc32 (0L, NULL, 0);
f76a33
 	unsigned char buffer[1024]; int len; 
f76a33
-	while ((len = zzip_mem_disk_fread (buffer, 1024, 1, file))) {
f76a33
+	while (0 < (len = zzip_mem_disk_fread (buffer, 1024, 1, file))) {
f76a33
 	    crc = crc32 (crc, buffer, len);
f76a33
 	}
f76a33
 	
f76a33
-- 
f76a33
2.32.0
f76a33
f76a33
f76a33
From d453977f59ca59c61bf59dec28dd724498828f2a Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:51:12 +0100
f76a33
Subject: [PATCH 3/7] #68 return value of zzip_entry_fread is signed
f76a33
f76a33
---
f76a33
 bins/unzzipcat-big.c | 4 ++--
f76a33
 1 file changed, 2 insertions(+), 2 deletions(-)
f76a33
f76a33
diff --git a/bins/unzzipcat-big.c b/bins/unzzipcat-big.c
f76a33
index 111ef47..ecebe11 100644
f76a33
--- a/bins/unzzipcat-big.c
f76a33
+++ b/bins/unzzipcat-big.c
f76a33
@@ -26,7 +26,7 @@ static void unzzip_big_entry_fprint(ZZIP_ENTRY* entry, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
+	while (0 < (len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
 	{
f76a33
 	    DBG2("entry read %i", len);
f76a33
 	    fwrite (buffer, len, 1, out);
f76a33
@@ -45,7 +45,7 @@ static void unzzip_cat_file(FILE* disk, char* name, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
+	while (0 < (len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
 	    fwrite (buffer, len, 1, out);
f76a33
 	
f76a33
 	zzip_entry_fclose (file);
f76a33
-- 
f76a33
2.32.0
f76a33
f76a33
f76a33
From 0a9db9ded9d15fbdb63bf5cf451920d0a368c00e Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:51:56 +0100
f76a33
Subject: [PATCH 4/7] #68 return value of zzip_mem_disk_fread is signed
f76a33
f76a33
---
f76a33
 bins/unzzipcat-mem.c | 4 ++--
f76a33
 1 file changed, 2 insertions(+), 2 deletions(-)
f76a33
f76a33
diff --git a/bins/unzzipcat-mem.c b/bins/unzzipcat-mem.c
f76a33
index 6bd79b7..1b5bc22 100644
f76a33
--- a/bins/unzzipcat-mem.c
f76a33
+++ b/bins/unzzipcat-mem.c
f76a33
@@ -35,7 +35,7 @@ static void unzzip_mem_entry_fprint(ZZIP_MEM_DISK* disk,
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_mem_disk_fread (buffer, 1024, 1, file)))
f76a33
+	while (0 < (len = zzip_mem_disk_fread (buffer, 1024, 1, file)))
f76a33
 	    fwrite (buffer, len, 1, out);
f76a33
 	
f76a33
 	zzip_mem_disk_fclose (file);
f76a33
@@ -48,7 +48,7 @@ static void unzzip_mem_disk_cat_file(ZZIP_MEM_DISK* disk, char* name, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1025]; int len;
f76a33
-	while ((len = zzip_mem_disk_fread (buffer, 1, 1024, file))) 
f76a33
+	while (0 < (len = zzip_mem_disk_fread (buffer, 1, 1024, file))) 
f76a33
 	{
f76a33
 	    fwrite (buffer, 1, len, out);
f76a33
 	}
f76a33
-- 
f76a33
2.32.0
f76a33
f76a33
f76a33
From a34a96fbda1e58fbec5c79f4c0b5063e031ce11d Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:52:47 +0100
f76a33
Subject: [PATCH 5/7] #68 return value of zzip_fread is signed
f76a33
f76a33
---
f76a33
 bins/unzzipcat-mix.c | 2 +-
f76a33
 1 file changed, 1 insertion(+), 1 deletion(-)
f76a33
f76a33
diff --git a/bins/unzzipcat-mix.c b/bins/unzzipcat-mix.c
f76a33
index e18987d..8f3d0b8 100644
f76a33
--- a/bins/unzzipcat-mix.c
f76a33
+++ b/bins/unzzipcat-mix.c
f76a33
@@ -34,7 +34,7 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_fread (buffer, 1, 1024, file))) 
f76a33
+	while (0 < (len = zzip_fread (buffer, 1, 1024, file))) 
f76a33
 	{
f76a33
 	    fwrite (buffer, 1, len, out);
f76a33
 	}
f76a33
-- 
f76a33
2.32.0
f76a33
f76a33
f76a33
From fa1f78abe1b08544061204019016809664f2618c Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:53:50 +0100
f76a33
Subject: [PATCH 6/7] #68 return value of zzip_entry_fread is signed
f76a33
f76a33
---
f76a33
 bins/unzzipshow.c | 4 ++--
f76a33
 1 file changed, 2 insertions(+), 2 deletions(-)
f76a33
f76a33
diff --git a/bins/unzzipshow.c b/bins/unzzipshow.c
f76a33
index 9d8c2ed..5672d3b 100644
f76a33
--- a/bins/unzzipshow.c
f76a33
+++ b/bins/unzzipshow.c
f76a33
@@ -22,7 +22,7 @@ static void zzip_entry_fprint(ZZIP_ENTRY* entry, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
+	while (0 < (len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
 	    fwrite (buffer, len, 1, out);
f76a33
 
f76a33
 	zzip_entry_fclose (file);
f76a33
@@ -35,7 +35,7 @@ static void zzip_cat_file(FILE* disk, char* name, FILE* out)
f76a33
     if (file) 
f76a33
     {
f76a33
 	char buffer[1024]; int len;
f76a33
-	while ((len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
+	while (0 < (len = zzip_entry_fread (buffer, 1024, 1, file)))
f76a33
 	    fwrite (buffer, len, 1, out);
f76a33
 	
f76a33
 	zzip_entry_fclose (file);
f76a33
-- 
f76a33
2.32.0
f76a33
f76a33
f76a33
From f7a6fa9f0c29aecb4c2299568ed2e6094c34aca7 Mon Sep 17 00:00:00 2001
f76a33
From: Guido Draheim <guidod@gmx.de>
f76a33
Date: Mon, 4 Jan 2021 21:55:08 +0100
f76a33
Subject: [PATCH 7/7] #68 return value of posix read(2) is signed
f76a33
f76a33
---
f76a33
 bins/zzipmake-zip.c | 2 +-
f76a33
 1 file changed, 1 insertion(+), 1 deletion(-)
f76a33
f76a33
diff --git a/bins/zzipmake-zip.c b/bins/zzipmake-zip.c
f76a33
index 8e09c31..b37877c 100644
f76a33
--- a/bins/zzipmake-zip.c
f76a33
+++ b/bins/zzipmake-zip.c
f76a33
@@ -57,7 +57,7 @@ int rezzip_make (int argc, char ** argv)
f76a33
 		continue;
f76a33
 	    }
f76a33
 
f76a33
-	    while ((n = read (input, buf, 16)))
f76a33
+	    while (0 < (n = read (input, buf, 16)))
f76a33
 	    {
f76a33
 		zzip_write (output, buf, n);
f76a33
 	    }
f76a33
-- 
f76a33
2.32.0
f76a33