Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: How many wide characters may mbstowcs store?
Date: Sun, 28 Jun 2020 06:32:18 -0700
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <864kqviae5.fsf@linuxsc.com>
References:
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="ff34e83bcc6e4b254240f67d19971e6a"; logging-data="10742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//Ol6ENp+TcOpmE6Cvwr5Fvl7M0xCxDIw="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:vAErg2/dT+wTQHEm0uTD0LwqH/U= sha1:41J78j8Zy4kGMzMHtNE3pf4azIc=
Xref: csiph.com comp.lang.c:152950
Andrey Tarasevich writes:
> On 5/11/2020 4:30 AM, Philipp Klaus Krause wrote:
>
>> For wcstombs, the wording seems clear to state that it will stop at a
>> terminating 0, but for the mbstowcs it seems unclear to me.
>
> The issue is fairly similar to the one described here
>
> https://trust-in-soft.com/blog/2015/12/21/memcmp-requires-pointers-to-fully-valid-buffers/
>
> The question is whether `memcmp` is allowed to read beyond the first
> differing byte, while still within the specified buffer size.
The question is similar. The answer isn't.