[RFC] _FORTIFY_SOURCE strictness
Paul Eggert
eggert@cs.ucla.edu
Fri Apr 8 21:07:41 GMT 2022
On 4/7/22 23:02, Siddhesh Poyarekar wrote:
> Hmm, I think I conflated it with something other str* function. You're
> right, strncpy probably doesn't fall into this category.
Ouch, I made the same mistake.
As for wcrtomb, unfortunately the standard's wording appears to allow
you to pass an output buffer smaller than MB_CUR_MAX if you know that
the multibyte character will fit into the smaller buffer. So I guess
this is an example of a function where __FORTIFY_LEVEL > 2 doesn't
conform to the standard.
I don't know whether the standard's authors intended this.
More information about the Libc-alpha
mailing list