C11 bounds checking interfaces in glibc?
KOSAKI Motohiro
kosaki.motohiro@gmail.com
Thu Feb 16 03:57:00 GMT 2012
2012/2/15 Andi Kleen <andi@firstfloor.org>:
> On Wed, Feb 15, 2012 at 09:11:18PM +0000, Joseph S. Myers wrote:
>> I don't think there are any plans; see
>> <http://sourceware.org/ml/libc-alpha/2011-12/msg00066.html> for what I
>> said about them and
>> <http://sourceware.org/ml/libc-alpha/2011-12/msg00064.html> for what
>> Roland said. In essence, they are rather a mess and *most* of them (other
>> than the reentrant functions) probably are not desirable for use in new
>> code - but there are probably uses for them for compiling some existing
>> bodies of code that have been retrofitted with them.
>
> So how do we get string functions with overflow checking instead?
>
> Is the general recommendation everyone has to use libbsd now?
>
> It's mainly of me being sick of writing
>
> #define strlcpy(d,s,l) snprintf(d,l,"%s",s), d
>
> everywhere. strcpy_s/strncpy_s/strcat_s seemed like reasonable
> replacements.
strl* functions are best, I think. Nowadays, really really much open source
products are using their functions and they are not safe when running on linux
because they often have wrong stub functions. That have made several unfortunate
thing. It would be very nice if glibc can support strl* too.
Of course, that's completely my personal opinion...
More information about the Libc-alpha
mailing list