Namespaces
Variants
Actions

Talk:c/string/wide/wcsncpy

From cppreference.com

The documentation do not seem to specify if destsz have been aligned to the nearest inferior multiple of two (const size_t exploitable_size = destsz & ~( size_t )1) prior to writing NULL terminating characters.

As a result I dont know if for cases where (destsz & 1 !=0) the stdlib is happily overwriting memory regions that it shouldnt.

For exemple, this explaination "on error, writes L'\0' to dest[0] (unless dest is a null pointer or destsz is zero or greater than RSIZE_MAX/sizeof(wchar_t))" is not very reassuring considering cases where an error is detected while destsz is 1. Sbillault (talk)