Date: Thu, 5 Feb 2026 17:08:04 +0100
On 05/02/2026 14:34, Alejandro Colomar wrote:
> Hi David,
>
> On 2026-02-05T09:05:43+0100, David Brown via Std-Proposals wrote:
>> And in view of dealing with potentially unvalidated data, it would be nice
>> if the C++ standard had "strnlen" here rather than just "strlen".
>
> C has adopted strnlen(3) for C2y. It was added by N3326.
> <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3326.pdf>
>
Good.
C has had "strnlen_s" since C11, but the optional Annex K
"bounds-checking" functions have been pretty much ignored by almost all
implementations. "strnlen_s" is, AFAICS, exactly the same as the
unofficial "strnlen" provided by most C libraries - it is good to see it
in the official C standards. I assume it will wander over to standard
C++ without too much delay.
> Hi David,
>
> On 2026-02-05T09:05:43+0100, David Brown via Std-Proposals wrote:
>> And in view of dealing with potentially unvalidated data, it would be nice
>> if the C++ standard had "strnlen" here rather than just "strlen".
>
> C has adopted strnlen(3) for C2y. It was added by N3326.
> <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3326.pdf>
>
Good.
C has had "strnlen_s" since C11, but the optional Annex K
"bounds-checking" functions have been pretty much ignored by almost all
implementations. "strnlen_s" is, AFAICS, exactly the same as the
unofficial "strnlen" provided by most C libraries - it is good to see it
in the official C standards. I assume it will wander over to standard
C++ without too much delay.
Received on 2026-02-05 16:08:11
