File CVE-2025-49112.patch of Package valkey
From 0b8147ca27d2d06efadf37f0f064f19607e7e1f8 Mon Sep 17 00:00:00 2001
From: Zeroday BYTE <github@zerodaysec.org>
Date: Tue, 20 May 2025 00:59:10 +0700
Subject: [PATCH] Update networking.c
Signed-off-by: Zeroday BYTE <github@zerodaysec.org>
---
src/networking.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/networking.c b/src/networking.c
index 5f57050971..78b62d0c59 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -883,7 +883,7 @@ void setDeferredReply(client *c, void *node, const char *s, size_t length) {
* - It has enough room already allocated
* - And not too large (avoid large memmove)
* - And the client is not in a pending I/O state */
- if (ln->prev != NULL && (prev = listNodeValue(ln->prev)) && prev->size - prev->used > 0 &&
+ if (ln->prev != NULL && (prev = listNodeValue(ln->prev)) && prev->used < prev->size &&
c->io_write_state != CLIENT_PENDING_IO) {
size_t len_to_copy = prev->size - prev->used;
if (len_to_copy > length) len_to_copy = length;