coredump: use a fixed string instead a scope-delimited compound literal
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).
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user