From 26bbb5c622d3ab7f98969b87528add911080c0f7 Mon Sep 17 00:00:00 2001 From: Pavel Šimovec Date: Jun 30 2023 11:10:35 +0000 Subject: check_overflow() function can work incorrectly that lead to an overflow --- diff --git a/sysstat-12.5.4-CVE-2023-33204.patch b/sysstat-12.5.4-CVE-2023-33204.patch new file mode 100644 index 0000000..c5afb4e --- /dev/null +++ b/sysstat-12.5.4-CVE-2023-33204.patch @@ -0,0 +1,23 @@ +From 954ff2e2673cef48f0ed44668c466eab041db387 Mon Sep 17 00:00:00 2001 +From: Pavel Kopylov +Date: Wed, 17 May 2023 11:33:45 +0200 +Subject: [PATCH] Fix an overflow which is still possible for some values. +diff --git a/common.c b/common.c +index 583a0ca..6d73b1b 100644 +--- a/common.c ++++ b/common.c +@@ -1639,9 +1639,11 @@ int parse_values(char *strargv, unsigned char bitmap[], int max_val, const char + */ + void check_overflow(size_t val1, size_t val2, size_t val3) + { +- if ((unsigned long long) val1 * +- (unsigned long long) val2 * +- (unsigned long long) val3 > UINT_MAX) { ++if ((val1 != 0) && (val2 != 0) && (val3 != 0) && ++ (((unsigned long long)UINT_MAX / (unsigned long long)val1 < ++ (unsigned long long)val2) || ++ ((unsigned long long)UINT_MAX / ((unsigned long long)val1 * ++ (unsigned long long)val2) < (unsigned long long)val3))) { + #ifdef DEBUG + fprintf(stderr, "%s: Overflow detected (%llu). Aborting...\n", + __FUNCTION__, diff --git a/sysstat.spec b/sysstat.spec index da6b112..d5f5f24 100644 --- a/sysstat.spec +++ b/sysstat.spec @@ -1,7 +1,7 @@ Summary: Collection of performance monitoring tools for Linux Name: sysstat Version: 12.5.4 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ URL: http://sebastien.godard.pagesperso-orange.fr/ Source: https://github.com/sysstat/sysstat/archive/v%{version}.tar.gz @@ -14,6 +14,7 @@ Source2: colorsysstat.sh Patch1: sysstat-12.5.4-CVE-2022-39377.patch # {cifsio,io,mp,pid}stat --dec and sar --dec report values from single alphabet other than defined (bz2080650) Patch2: sysstat-12.5.4-bz2080650.patch +Patch3: sysstat-12.5.4-CVE-2023-33204.patch BuildRequires: make BuildRequires: gcc, gettext, lm_sensors-devel, pcp-libs-devel, systemd, git @@ -91,6 +92,9 @@ fi %{_localstatedir}/log/sa %changelog +* Fri Jun 30 2023 Pavel Šimovec - 12.5.4-6 +- fix the arithmetic overflow in allocate_structures() that is still possible on some 32 bit systems (CVE-2023-33204) + * Tue Feb 21 2023 Lukáš Zaoral - 12.5.4-5 - Fix --dec argument validation (rhbz#2080650)