The iconv buffer sizes must not include the \0 string terminator.
(When \0 cannot be part of a valid character encoding glibc iconv
would copy it to the output as expected, but then later the explicit
output termination with *outbufpos = '\0' is out of bounds.)
char ascii[] = CONV_INPUT;
char *inbufpos = ascii;
- size_t inbytesleft = sizeof (CONV_INPUT);
+ size_t inbytesleft = sizeof (CONV_INPUT) - 1;
char *utf8 = xcalloc (sizeof (CONV_INPUT), 1);
char *outbufpos = utf8;
- size_t outbytesleft = sizeof (CONV_INPUT);
+ size_t outbytesleft = sizeof (CONV_INPUT) - 1;
if (tidx < TCOUNT/2)
/* The first half of the worker thread pool synchronize together here,