[PATCH] wcstombs: also call __WCTOMB on terminating NUL if output buffer is NULL
Corinna Vinschen
vinschen@redhat.com
Wed Jul 2 16:16:19 GMT 2025
On Jul 1 11:17, Christian Franke wrote:
> From 32a58b0df028c5894f4a8d02fabf89a8d90e16f2 Mon Sep 17 00:00:00 2001
> From: Christian Franke <christian.franke@t-online.de>
> 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 <christian.franke@t-online.de>
> ---
> newlib/libc/stdlib/wcstombs_r.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Pushed.
Thanks,
Corinna
More information about the Newlib
mailing list