fix CVE-2023-33204

(cherry picked from commit b2114d88c437a8147646c1c7d1dcc0507da1d767)
This commit is contained in:
zhouwenpei 2023-05-25 08:38:47 +00:00 committed by openeuler-sync-bot
parent e8bcd2deca
commit 0d197e7416
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,41 @@
From 954ff2e2673cef48f0ed44668c466eab041db387 Mon Sep 17 00:00:00 2001
From: Pavel Kopylov <pkopylov@cloudlinux.com>
Date: Wed, 17 May 2023 11:33:45 +0200
Subject: [PATCH] Fix an overflow which is still possible for some values.
Reference:https://github.com/sysstat/sysstat/commit/6f8dc568e6ab072bb8205b732f04e685bf9237c0
Conflict:Adaptation Context
---
common.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/common.c b/common.c
index 28d475e..85b2457 100644
--- a/common.c
+++ b/common.c
@@ -1541,15 +1541,16 @@ 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__,
- (unsigned long long) val1 * (unsigned long long) val2 * (unsigned long long) val3);
+ fprintf(stderr, "%s: Overflow detected (%u,%u,%u). Aborting...\n",
+ __FUNCTION__, val1, val2, val3);
#endif
- exit(4);
+ exit(4);
}
}
--
2.33.0

View File

@ -1,12 +1,13 @@
Name: sysstat
Version: 12.5.4
Release: 6
Release: 7
Summary: System performance tools for the Linux operating system
License: GPLv2+
URL: http://sebastien.godard.pagesperso-orange.fr/
Source0: https://github.com/sysstat/sysstat/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz
Patch0000: backport-CVE-2022-39377.patch
Patch6000: backport-CVE-2022-39377.patch
Patch6001: backport-CVE-2023-33204.patch
BuildRequires: gcc, gettext, lm_sensors-devel, systemd
@ -88,6 +89,9 @@ export compressafter="31"
%{_mandir}/man*/*
%changelog
* Thu May 25 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 12.5.4-7
- fix CVE-2023-33204
* Fri Apr 14 2023 wangjiang <wangjiang37@h-partners.com> - 12.5.4-6
- service auto start after install