Adding strlcpy and strlcat replacements to libradius

Alan DeKok aland at ox.org
Tue Sep 20 02:35:26 CEST 2005


Nicolas Baradakis <nbk at sitadelle.com> wrote:
> 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 agree.

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

  strNcpy should be deleted, and all calls to it replaced with strlcpy.

> 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

  Yes.

  Alan DeKok.



More information about the Freeradius-Devel mailing list