Fix: cve-2020-18770
The previous patch introduced a segfault Resolves: RHEL-14966
This commit is contained in:
parent
04259f737b
commit
bbba16396a
@ -1,30 +1,23 @@
|
|||||||
From 18c6c043bd7d8f139f30e9c7749013115d5fc5b7 Mon Sep 17 00:00:00 2001
|
From 803f49aaae16b7f2899e4769afdfc673a21fa9e8 Mon Sep 17 00:00:00 2001
|
||||||
From: Valentin Lefebvre <valentin.lefebvre@suse.com>
|
From: Guido Draheim <guidod@gmx.de>
|
||||||
Date: Wed, 20 Sep 2023 12:04:56 +0200
|
Date: Mon, 26 Feb 2024 23:17:12 +0100
|
||||||
Subject: [PATCH] mmappend.c: Avoid invalid access for header entry
|
Subject: [PATCH] #69 assert full zzip_file_header
|
||||||
|
|
||||||
* zzip_disk_entry_to_file_header checking the pointer by substraction
|
|
||||||
instead of addition where it could lead to an invalid access memory.
|
|
||||||
* CVE-2020-18770
|
|
||||||
|
|
||||||
Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
|
|
||||||
---
|
---
|
||||||
zzip/mmapped.c | 5 +++--
|
zzip/mmapped.c | 3 ++-
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/zzip/mmapped.c b/zzip/mmapped.c
|
diff --git a/zzip/mmapped.c b/zzip/mmapped.c
|
||||||
index 2071882..beb094d 100644
|
index 2071882..306ba51 100644
|
||||||
--- a/zzip/mmapped.c
|
--- a/zzip/mmapped.c
|
||||||
+++ b/zzip/mmapped.c
|
+++ b/zzip/mmapped.c
|
||||||
@@ -275,8 +275,9 @@ zzip_disk_entry_to_data(ZZIP_DISK * disk, struct zzip_disk_entry * entry)
|
@@ -276,7 +276,8 @@ struct zzip_file_header *
|
||||||
struct zzip_file_header *
|
|
||||||
zzip_disk_entry_to_file_header(ZZIP_DISK * disk, struct zzip_disk_entry *entry)
|
zzip_disk_entry_to_file_header(ZZIP_DISK * disk, struct zzip_disk_entry *entry)
|
||||||
{
|
{
|
||||||
- zzip_byte_t *const ptr = disk->buffer + zzip_disk_entry_fileoffset(entry);
|
zzip_byte_t *const ptr = disk->buffer + zzip_disk_entry_fileoffset(entry);
|
||||||
- if (disk->buffer > ptr || ptr >= disk->endbuf)
|
- if (disk->buffer > ptr || ptr >= disk->endbuf)
|
||||||
+ zzip_off_t off = zzip_disk_entry_fileoffset(entry);
|
+ zzip_byte_t *const end = ptr + sizeof(struct zzip_file_header);
|
||||||
+ zzip_byte_t *const ptr = disk->buffer + off;
|
+ if (disk->buffer > ptr || end >= disk->endbuf || end <= NULL)
|
||||||
+ if (disk->buffer > ptr || disk->buffer >= disk->endbuf - off)
|
|
||||||
{
|
{
|
||||||
errno = EBADMSG;
|
errno = EBADMSG;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Lightweight library to easily extract data from zip files
|
Summary: Lightweight library to easily extract data from zip files
|
||||||
Name: zziplib
|
Name: zziplib
|
||||||
Version: 0.13.68
|
Version: 0.13.68
|
||||||
Release: 12%{?dist}
|
Release: 13%{?dist}
|
||||||
License: LGPLv2+ or MPLv1.1
|
License: LGPLv2+ or MPLv1.1
|
||||||
Group: Applications/Archiving
|
Group: Applications/Archiving
|
||||||
URL: http://zziplib.sourceforge.net/
|
URL: http://zziplib.sourceforge.net/
|
||||||
@ -147,6 +147,11 @@ make install DESTDIR=%{buildroot}
|
|||||||
%{_mandir}/man3/*
|
%{_mandir}/man3/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Feb 28 2024 Jakub Martisko <jamartis@redhat.com> - 0.13.68-13
|
||||||
|
- Fix CVE-2020-18770
|
||||||
|
Previous patch contained segfault bug
|
||||||
|
Resolves: RHEL-14966
|
||||||
|
|
||||||
* Tue Feb 06 2024 Jakub Martisko <jamartis@redhat.com> - 0.13.68-12
|
* Tue Feb 06 2024 Jakub Martisko <jamartis@redhat.com> - 0.13.68-12
|
||||||
- Add the gating tests from the 8.8.0 branch
|
- Add the gating tests from the 8.8.0 branch
|
||||||
Resolves: RHEL-24429
|
Resolves: RHEL-24429
|
||||||
|
Loading…
Reference in New Issue
Block a user