Blame SOURCES/0003-Xquartz-ProcAppleDRICreatePixmap-needs-to-use-unswap.patch

191e41
From 6c684d035c06fd41c727f0ef0744517580864cef Mon Sep 17 00:00:00 2001
191e41
From: Alan Coopersmith <alan.coopersmith@oracle.com>
191e41
Date: Fri, 22 Mar 2024 19:07:34 -0700
191e41
Subject: [PATCH 3/4] Xquartz: ProcAppleDRICreatePixmap needs to use unswapped
191e41
 length to send reply
191e41
191e41
CVE-2024-31082
191e41
191e41
Fixes: 14205ade0 ("XQuartz: appledri: Fix byte swapping in replies")
191e41
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
191e41
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1463>
191e41
---
191e41
 hw/xquartz/xpr/appledri.c | 4 +++-
191e41
 1 file changed, 3 insertions(+), 1 deletion(-)
191e41
191e41
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
191e41
index 77574655b..40422b61a 100644
191e41
--- a/hw/xquartz/xpr/appledri.c
191e41
+++ b/hw/xquartz/xpr/appledri.c
191e41
@@ -272,6 +272,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
191e41
     xAppleDRICreatePixmapReply rep;
191e41
     int width, height, pitch, bpp;
191e41
     void *ptr;
191e41
+    CARD32 stringLength;
191e41
 
191e41
     REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq);
191e41
 
191e41
@@ -307,6 +308,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
191e41
     if (sizeof(rep) != sz_xAppleDRICreatePixmapReply)
191e41
         ErrorF("error sizeof(rep) is %zu\n", sizeof(rep));
191e41
 
191e41
+    stringLength = rep.stringLength;  /* save unswapped value */
191e41
     if (client->swapped) {
191e41
         swaps(&rep.sequenceNumber);
191e41
         swapl(&rep.length);
191e41
@@ -319,7 +321,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
191e41
     }
191e41
 
191e41
     WriteToClient(client, sizeof(rep), &rep;;
191e41
-    WriteToClient(client, rep.stringLength, path);
191e41
+    WriteToClient(client, stringLength, path);
191e41
 
191e41
     return Success;
191e41
 }
191e41
-- 
191e41
2.44.0
191e41