From 4f688e61c95dc6848a624864c295c62b8c2ab3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 18 May 2026 12:31:46 +0200 Subject: [PATCH] coredump: use a fixed string instead a scope-delimited compound literal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compound literal (const char[]){'.','.','.'} has block scope (C99 6.5.2.5p6). Once we leave the if and loop back, copy[1].iov_base formally points into a destroyed object. Works on GCC/Clang in practice, but is UB. Let's do the easy thing and use a string. Reported by qarmin (RafaƂ Mikrut). --- src/coredump/coredump-send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coredump/coredump-send.c b/src/coredump/coredump-send.c index 0174be69a4..4817d82611 100644 --- a/src/coredump/coredump-send.c +++ b/src/coredump/coredump-send.c @@ -57,7 +57,7 @@ int coredump_send(CoredumpContext *context) { * what we want to send, and the second one contains * the trailing dots. */ copy[0] = *iovec; - copy[1] = IOVEC_MAKE(((const char[]){'.', '.', '.'}), 3); + copy[1] = IOVEC_MAKE_STRING("..."); mh.msg_iov = copy; mh.msg_iovlen = 2;