[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] strlcpy & strlcat APIs

From: Bruno Haible
Subject: Re: [bug-gnulib] strlcpy & strlcat APIs
Date: Wed, 2 Mar 2005 13:13:32 +0100
User-agent: KMail/1.5

Mark D. Baushke wrote:
> I am curious to know if the GNULIB project would consider adopting
> two more string manipulation functions: strlcpy() and strlcat().
> For those who may not have heard of these functions previously,
> here are some pointers to information concerning them:
>   http://www.openbsd.org/papers/strlcpy-paper.ps
>   http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcpy.c
>   http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcat.c
>   http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcpy.3
>      size_t
>      strlcpy(char *dst, const char *src, size_t size);
>      size_t
>      strlcat(char *dst, const char *src, size_t size);
> The strlcpy function copies at most size-1 characters and
> always NUL terminates (unless size == 0). The result is
> strlen(src); if the returned value >= size), truncation
> occured.
> The strlcat function appends src to dst of size bytes. At
> most size-1 characters will be copied. Always NUL terminates
> (unless size <= strlen(dst)). The result is strlen(initial
> dst) + strlen(src); if the returned value >= size,
> truncation occured.


It seems we already have discussed this:


reply via email to

[Prev in Thread] Current Thread [Next in Thread]