diff --git a/backport-CVE-2023-45145.patch b/backport-CVE-2023-45145.patch new file mode 100644 index 0000000000000000000000000000000000000000..5b634036ca481ea54c0c809011599e970fc194e9 --- /dev/null +++ b/backport-CVE-2023-45145.patch @@ -0,0 +1,55 @@ +From e6d8603e3daa9858e063f85d759851e230bbc4af Mon Sep 17 00:00:00 2001 +From: root +Date: Fri, 22 Dec 2023 11:01:49 +0800 +Subject: [PATCH] 888 + +--- + src/anet.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/anet.c b/src/anet.c +index 2981fca..7c8d85a 100644 +--- a/src/anet.c ++++ b/src/anet.c +@@ -437,13 +437,16 @@ int anetWrite(int fd, char *buf, int count) + return totlen; + } + +-static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len, int backlog) { ++static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len, int backlog, mode_t perm) { + if (bind(s,sa,len) == -1) { + anetSetError(err, "bind: %s", strerror(errno)); + close(s); + return ANET_ERR; + } + ++ if (sa->sa_family == AF_LOCAL && perm) ++ chmod(((struct sockaddr_un *) sa)->sun_path, perm); ++ + if (listen(s, backlog) == -1) { + anetSetError(err, "listen: %s", strerror(errno)); + close(s); +@@ -484,7 +487,7 @@ static int _anetTcpServer(char *err, int port, char *bindaddr, int af, int backl + + if (af == AF_INET6 && anetV6Only(err,s) == ANET_ERR) goto error; + if (anetSetReuseAddr(err,s) == ANET_ERR) goto error; +- if (anetListen(err,s,p->ai_addr,p->ai_addrlen,backlog) == ANET_ERR) s = ANET_ERR; ++ if (anetListen(err,s,p->ai_addr,p->ai_addrlen,backlog,0) == ANET_ERR) s = ANET_ERR; + goto end; + } + if (p == NULL) { +@@ -521,10 +524,8 @@ int anetUnixServer(char *err, char *path, mode_t perm, int backlog) + memset(&sa,0,sizeof(sa)); + sa.sun_family = AF_LOCAL; + strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1); +- if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa),backlog) == ANET_ERR) ++ if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa),backlog,perm) == ANET_ERR) + return ANET_ERR; +- if (perm) +- chmod(sa.sun_path, perm); + return s; + } + +-- +2.33.0 + diff --git a/redis5.spec b/redis5.spec index 1906447a29b0140271acb72dd4b0c4a397f32f67..f19a3c71982d3fe0136dcc366353c82cba224cd7 100644 --- a/redis5.spec +++ b/redis5.spec @@ -6,7 +6,7 @@ %global Pname redis Name: redis5 Version: 5.0.7 -Release: 6 +Release: 7 Summary: A persistent key-value database License: BSD and MIT URL: https://redis.io @@ -26,6 +26,7 @@ Patch0001: Modify-aarch64-architecture-jemalloc-page-size-from-from-4k Patch0002: Fix-redis5-gcc-10.patch Patch0003: Add-loongarch64-support.patch Patch0004: Update-config.guess-and-config.sub.patch +Patch0005: backport-CVE-2023-45145.patch BuildRequires: gcc %if %{with tests} @@ -94,6 +95,7 @@ tar -xvf %{SOURCE10} %patch0003 -p1 %patch0004 -p1 %endif +%patch0005 -p1 mv ../%{Pname}-doc-%{doc_commit} doc mv deps/lua/COPYRIGHT COPYRIGHT-lua mv deps/hiredis/COPYING COPYING-hiredis @@ -198,6 +200,9 @@ exit 0 %{_docdir}/%{Pname} %changelog +* Fri Dec 22 2023 shaominghao - 5.0.7-7 +- Fix CVE-2023-45145 + * Mon Dec 18 2023 xiexing - 5.0.7-6 - add Conflicts in spec