sysstat/SOURCES/sysstat-12.5.4-CVE-2023-33204.patch

37 lines
1.2 KiB
Diff
Raw Permalink Normal View History

2024-09-30 16:42:42 +00:00
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>
2023-09-21 20:32:08 +00:00
diff --git a/common.c b/common.c
2024-09-30 16:42:42 +00:00
index 48493b5f..0efe7ee3 100644
2023-09-21 20:32:08 +00:00
--- a/common.c
+++ b/common.c
2024-09-30 16:42:42 +00:00
@@ -431,15 +431,17 @@ int check_dir(char *dirname)
void check_overflow(unsigned int val1, unsigned int val2,
unsigned int val3)
2023-09-21 20:32:08 +00:00
{
2024-09-30 16:42:42 +00:00
- if ((unsigned long long) val1 * (unsigned long long) val2 *
2023-09-21 20:32:08 +00:00
- (unsigned long long) val3 > UINT_MAX) {
2024-09-30 16:42:42 +00:00
+ 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))) {
2023-09-21 20:32:08 +00:00
#ifdef DEBUG
2024-09-30 16:42:42 +00:00
- 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