Re: [PATCH] wcstombs: also call __WCTOMB on terminating NUL if output buffer is NULL

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Jul  1 11:17, Christian Franke wrote:
> From 32a58b0df028c5894f4a8d02fabf89a8d90e16f2 Mon Sep 17 00:00:00 2001
> From: Christian Franke <[email protected]>
> Date: Tue, 1 Jul 2025 11:00:41 +0200
> Subject: [PATCH] wcstombs: also call __WCTOMB on terminating NUL if output
>  buffer is NULL
> 
> A __WCTOMB call on the terminating NUL may emit more than a NUL byte.
> This is the case if the string ends with a lone UTF-16 high surrogate.
> 
> Fixes: 2a3a02a68764 ("Add SUSV2 support for calculating size if output buffer is NULL")
> Signed-off-by: Christian Franke <[email protected]>
> ---
>  newlib/libc/stdlib/wcstombs_r.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Pushed.

Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.