From c1b8cdbbe685dc709c9df271e5ba7561c4b397ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 2 Jan 2025 13:30:42 -0500
Subject: [PATCH] Actually we only need to not pass rd, SSIZE_MAX doesn't
 matter

---
 src/xpdev/sockwrap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xpdev/sockwrap.c b/src/xpdev/sockwrap.c
index 31e2949bfd..ed4bb4d8d1 100644
--- a/src/xpdev/sockwrap.c
+++ b/src/xpdev/sockwrap.c
@@ -196,8 +196,8 @@ off_t sendfilesocket(int sock, int file, off_t *offset, off_t count)
 		for (i = wr = 0; i < rd; i += wr) {
 			wr = sendsocket(sock,buf+i,rd-i);
 			if (wr > 0) {
-				if ((SSIZE_MAX - i) < wr)
-					wr = SSIZE_MAX - i;
+				if ((rd - i) < wr)
+					wr = rd - i;
 				continue;
 			}
 			if (wr == SOCKET_ERROR && SOCKET_ERRNO == EWOULDBLOCK) {
-- 
GitLab