Xquartz: ProcAppleDRICreatePixmap needs to use unswapped length to send reply
CVE-2024-31082 Fixes:14205ade0("XQuartz: appledri: Fix byte swapping in replies") Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1463> (cherry picked from commit6c684d035c)
This commit is contained in:
		
							parent
							
								
									cea92ca78f
								
							
						
					
					
						commit
						0e34d8ebc9
					
				| 
						 | 
				
			
			@ -272,6 +272,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
 | 
			
		|||
    xAppleDRICreatePixmapReply rep;
 | 
			
		||||
    int width, height, pitch, bpp;
 | 
			
		||||
    void *ptr;
 | 
			
		||||
    CARD32 stringLength;
 | 
			
		||||
 | 
			
		||||
    REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -307,6 +308,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
 | 
			
		|||
    if (sizeof(rep) != sz_xAppleDRICreatePixmapReply)
 | 
			
		||||
        ErrorF("error sizeof(rep) is %zu\n", sizeof(rep));
 | 
			
		||||
 | 
			
		||||
    stringLength = rep.stringLength;  /* save unswapped value */
 | 
			
		||||
    if (client->swapped) {
 | 
			
		||||
        swaps(&rep.sequenceNumber);
 | 
			
		||||
        swapl(&rep.length);
 | 
			
		||||
| 
						 | 
				
			
			@ -319,7 +321,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    WriteToClient(client, sizeof(rep), &rep);
 | 
			
		||||
    WriteToClient(client, rep.stringLength, path);
 | 
			
		||||
    WriteToClient(client, stringLength, path);
 | 
			
		||||
 | 
			
		||||
    return Success;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue