sysstat/sysstat-12.5.4-CVE-2023-33204.patch
Lukáš Zaoral 0d73b18538
fix allocation errors with malformed sa files
- reorder patches to prevent errors during their application

Resolves: RHEL-35684
2024-05-07 17:09:47 +02:00

37 lines
1.2 KiB
Diff

From commit 6f8dc568e6ab072bb8205b732f04e685bf9237c0
From: Sebastien GODARD <sysstat@users.noreply.github.com>
Date: Wed, May 17 21:10:31 2023 +0200
Subject: Merge branch 'pkopylov-master'
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
diff --git a/common.c b/common.c
index 48493b5f..0efe7ee3 100644
--- a/common.c
+++ b/common.c
@@ -431,15 +431,17 @@ int check_dir(char *dirname)
void check_overflow(unsigned int val1, unsigned int val2,
unsigned int 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);
+ }
}
#ifndef SOURCE_SADC