2 * Check decoding of non-NUL-terminated strings when len == -1.
4 * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
5 * Copyright (c) 2016-2018 The strace developers.
8 * SPDX-License-Identifier: GPL-2.0-or-later
21 char *const buf = tail_alloc(DEFAULT_STRLEN + 1);
32 memset(buf + 1, 'X', DEFAULT_STRLEN);
33 buf[DEFAULT_STRLEN - 1] = 0;
35 rc = writev(-1, &io, 1);
36 tprintf("writev(-1, [{iov_base=\"\\0%*s\\0\"..., iov_len=%lu}], 1)"
37 " = %s\n", DEFAULT_STRLEN - 2, buf + 1, -1UL, sprintrc(rc));
39 buf[DEFAULT_STRLEN - 1] = 'X';
40 buf[DEFAULT_STRLEN] = 0;
42 rc = writev(-1, &io, 1);
43 tprintf("writev(-1, [{iov_base=\"\\0%*s\"..., iov_len=%lu}], 1)"
44 " = %s\n", DEFAULT_STRLEN - 1, buf + 1, -1UL, sprintrc(rc));
47 rc = writev(-1, &io, 1);
48 tprintf("writev(-1, [{iov_base=%p, iov_len=%lu}], 1) = %s\n",
49 io.iov_base, -1UL, sprintrc(rc));
51 tprintf("+++ exited with 0 +++\n");