fix mem_size overflow
This commit is contained in:
parent
b0ea224933
commit
82ea9f483f
41
fix-mem_size-overflow.patch
Normal file
41
fix-mem_size-overflow.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 299246408d3442a3240ccf25ce31c08ecee64766 Mon Sep 17 00:00:00 2001
|
||||
From: wu-leilei <wu18740459704@163.com>
|
||||
Date: Mon, 20 Dec 2021 10:14:35 +0800
|
||||
Subject: [PATCH] fix mem_size overflow
|
||||
|
||||
---
|
||||
alloc.h | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/alloc.h b/alloc.h
|
||||
index 34a05f4..89cb727 100644
|
||||
--- a/alloc.h
|
||||
+++ b/alloc.h
|
||||
@@ -33,6 +33,11 @@
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
|
||||
+#ifndef _WIN32
|
||||
+#include <sys/sysinfo.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -55,6 +60,12 @@ void hiredisResetAllocators(void);
|
||||
extern hiredisAllocFuncs hiredisAllocFns;
|
||||
|
||||
static inline void *hi_malloc(size_t size) {
|
||||
+#ifndef _WIN32
|
||||
+ struct sysinfo s_info;
|
||||
+ int error;
|
||||
+ if((error = sysinfo(&s_info)) < 0) return NULL;
|
||||
+ if(s_info.totalram < size) return NULL;
|
||||
+#endif
|
||||
return hiredisAllocFns.mallocFn(size);
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: hiredis
|
||||
Version: 1.0.2
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: A minimalistic C client library for the Redis database
|
||||
License: BSD
|
||||
URL: https://github.com/redis/hiredis
|
||||
@ -8,6 +8,7 @@ Source0: https://github.com/redis/hiredis/archive/refs/tags/v%{version}.t
|
||||
BuildRequires: gcc redis
|
||||
|
||||
Patch0001: fix-heap-buffer-overflow-in-redisvFormatCommand.patch
|
||||
Patch0002: fix-mem_size-overflow.patch
|
||||
|
||||
%description
|
||||
Hiredis is a minimalistic C client library for the Redis database.
|
||||
@ -60,6 +61,9 @@ make check || true
|
||||
%{_libdir}/pkgconfig/hiredis.pc
|
||||
|
||||
%changelog
|
||||
* Mon Dec 20 2021 wulei<wulei80@huawei.com> - 1.0.2-2
|
||||
- Fix mem_size overflow
|
||||
|
||||
* Mon Oct 11 2021 houyingchao<houyingchao@huawei.com> - 1.0.2-1
|
||||
- Fix CVE-2021-32765
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user