Fix CVE-2023-2603

- Fix integer overflow in _libcap_strdup() (CVE-2023-2603)

Resolves: rhbz#2210638

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
Anderson Toshiyuki Sasaki 2023-07-12 11:07:49 +02:00
parent c475283dde
commit 5a15faf328
2 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,18 @@
--- a/libcap/cap_alloc.c 2023-06-26 18:42:42.295817583 +0200
+++ b/libcap/cap_alloc.c 2023-06-26 18:40:32.485375859 +0200
@@ -82,7 +82,14 @@
return NULL;
}
- raw_data = malloc( sizeof(__u32) + strlen(old) + 1 );
+ size_t len = strlen(old);
+ if ((len & 0x3fffffff) != len) {
+ _cap_debug("len is too long for libcap to manage");
+ errno = EINVAL;
+ return NULL;
+ }
+ len += 1 + sizeof(__u32);
+ raw_data = calloc(1, len);
if (raw_data == NULL) {
errno = ENOMEM;
return NULL;

View File

@ -1,6 +1,6 @@
Name: libcap
Version: 2.48
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Library for getting and setting POSIX.1e capabilities
URL: https://sites.google.com/site/fullycapable/
License: BSD or GPLv2
@ -12,6 +12,7 @@ Patch2: libcap-static-analysis-fix-2.patch
Patch3: libcap-static-analysis-fix-3.patch
Patch4: libcap-disable-golang.patch
Patch5: libcap-fix-ambient-caps.patch
Patch6: libcap-cve-2023-2603.patch
BuildRequires: libattr-devel pam-devel perl-interpreter gcc
BuildRequires: make
@ -88,6 +89,10 @@ chmod +x %{buildroot}/%{_libdir}/*.so.*
%changelog
* Wed Jul 12 2023 Anderson Toshiyuki Sasaki <ansasaki@redhat.com> - 2.48-9
- Fix integer overflow in _libcap_strdup() (CVE-2023-2603)
Resolves: rhbz#2210638
* Fri Jan 28 2022 Zoltan Fridrich <zfridric@redhat.com> - 2.48-8
- Fix ambient capabilities for non-root users
Related: rhbz#2037215