Adding strlcpy and strlcat replacements to libradius

Nicolas Baradakis nbk at sitadelle.com
Tue Sep 20 02:29:22 CEST 2005


I think we may perhaps add an autoconf test to detect whether the
system provides the srtlcpy and strlcat functions from OpenBSD.
If they're not present, we'd compile a replacement in libradius.

These functions provide a consistent, unambiguous API described in
this paper:
http://www.usenix.org/events/usenix99/full_papers/millert/millert_html/index.html

I know that our home-made strNcpy already ensures NUL-terminaison,
but it has some weakness:
- it seems it's wrong when N <= 0
- it's not easy to check if truncation has occurred

I don't plan to change the code everywhere, but I'd like to have the
functions available when writing new code.

If I get approbation, I suggest to bring the following files in
libradius. As to my understanding their licence allows us to do that:
ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcpy.c
ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcat.c

-- 
Nicolas Baradakis



More information about the Freeradius-Devel mailing list