From: Szabolcs Nagy Date: Mon, 26 Sep 2022 14:38:19 +0000 (+0100) Subject: Fix off-by-one error in iconv/tst-iconv-mt X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00f9cd1a70c35304b4fb4b6dbcdf2f78228c912b;p=thirdparty%2Fglibc.git Fix off-by-one error in iconv/tst-iconv-mt 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.) --- diff --git a/iconv/tst-iconv-mt.c b/iconv/tst-iconv-mt.c index daaebd273bb..0320885c069 100644 --- a/iconv/tst-iconv-mt.c +++ b/iconv/tst-iconv-mt.c @@ -58,11 +58,11 @@ worker (void * arg) 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,