Blame SOURCES/CVE-2018-7726.part2.patch
|
|
5cf55c |
From 19c9e4dc6c5cf92a38d0d23dbccac6993f9c41be Mon Sep 17 00:00:00 2001
|
|
|
5cf55c |
From: Guido Draheim <guidod@gmx.de>
|
|
|
5cf55c |
Date: Tue, 13 Mar 2018 01:50:36 +0100
|
|
|
5cf55c |
Subject: [PATCH] check rootseek after correction #41
|
|
|
5cf55c |
|
|
|
5cf55c |
---
|
|
|
5cf55c |
zzip/zip.c | 9 ++++++---
|
|
|
5cf55c |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
5cf55c |
|
|
|
5cf55c |
diff --git a/zzip/zip.c b/zzip/zip.c
|
|
|
5cf55c |
index 6be8d7c..0d79d52 100644
|
|
|
5cf55c |
--- a/zzip/zip.c
|
|
|
5cf55c |
+++ b/zzip/zip.c
|
|
|
5cf55c |
@@ -1,4 +1,3 @@
|
|
|
5cf55c |
-
|
|
|
5cf55c |
/*
|
|
|
5cf55c |
* Author:
|
|
|
5cf55c |
* Guido Draheim <guidod@gmx.de>
|
|
|
5cf55c |
@@ -422,6 +421,9 @@ __zzip_parse_root_directory(int fd,
|
|
|
5cf55c |
zzip_off64_t zz_rootseek = _disk_trailer_rootseek(trailer);
|
|
|
5cf55c |
__correct_rootseek(zz_rootseek, zz_rootsize, trailer);
|
|
|
5cf55c |
|
|
|
5cf55c |
+ if (zz_entries < 0 || zz_rootseek < 0 || zz_rootseek < 0)
|
|
|
5cf55c |
+ return ZZIP_CORRUPTED;
|
|
|
5cf55c |
+
|
|
|
5cf55c |
hdr0 = (struct zzip_dir_hdr *) malloc(zz_rootsize);
|
|
|
5cf55c |
if (! hdr0)
|
|
|
5cf55c |
return ZZIP_DIRSIZE;
|
|
|
5cf55c |
@@ -465,8 +467,9 @@ __zzip_parse_root_directory(int fd,
|
|
|
5cf55c |
# endif
|
|
|
5cf55c |
|
|
|
5cf55c |
if (fd_map)
|
|
|
5cf55c |
- { d = (void*)(fd_map+zz_fd_gap+zz_offset); } /* fd_map+fd_gap==u_rootseek */
|
|
|
5cf55c |
- else
|
|
|
5cf55c |
+ {
|
|
|
5cf55c |
+ d = (void*)(fd_map+zz_fd_gap+zz_offset); /* fd_map+fd_gap==u_rootseek */
|
|
|
5cf55c |
+ } else
|
|
|
5cf55c |
{
|
|
|
5cf55c |
if (io->fd.seeks(fd, zz_rootseek + zz_offset, SEEK_SET) < 0)
|
|
|
5cf55c |
return ZZIP_DIR_SEEK;
|