public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] Fix off-by-one error in iconv/tst-iconv-mt Date: Wed, 12 Oct 2022 14:15:24 +0000 (GMT) [thread overview] Message-ID: <20221012141524.BEBCB3858034@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=00f9cd1a70c35304b4fb4b6dbcdf2f78228c912b commit 00f9cd1a70c35304b4fb4b6dbcdf2f78228c912b Author: Szabolcs Nagy <szabolcs.nagy@arm.com> Date: Mon Sep 26 15:38:19 2022 +0100 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: --- iconv/tst-iconv-mt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iconv/tst-iconv-mt.c b/iconv/tst-iconv-mt.c index daaebd273b..0320885c06 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,
next reply other threads:[~2022-10-12 14:15 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-12 14:15 Szabolcs Nagy [this message] 2022-10-26 15:10 Szabolcs Nagy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221012141524.BEBCB3858034@sourceware.org \ --to=nsz@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).