From 75c5bdee81b3a1147c2f123db7a052a4a79fbea4 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 29 Sep 2024 10:04:40 -0700 Subject: [PATCH] _XimEncodingNegotiation: swap order of arguments to calloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoids build failures with gcc 14.2 when MALLOC_0_RETURNS_NULL is defined: imDefIm.c: In function ‘_XimEncodingNegotiation’: imDefIm.c:1739:15: error: ‘memcpy’ offset 8 is out of the bounds [0, 1] [-Werror=array-bounds=] 1739 | (void)memcpy((char *)&buf_s[2], name_ptr, name_len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith Part-of: --- modules/im/ximcp/imDefIm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/im/ximcp/imDefIm.c b/modules/im/ximcp/imDefIm.c index e3075398..2f821d15 100644 --- a/modules/im/ximcp/imDefIm.c +++ b/modules/im/ximcp/imDefIm.c @@ -1728,7 +1728,7 @@ _XimEncodingNegotiation( + sizeof(CARD16) + detail_len; - if (!(buf = Xcalloc(XIM_HEADER_SIZE + len, 1))) + if (!(buf = Xcalloc(1, XIM_HEADER_SIZE + len))) goto free_detail_ptr; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];