Re: [gtk-list] Glib proposal: add strlcpy and strlcat to glib
- From: Havoc Pennington <hp redhat com>
- To: gtk-devel-list gnome org
- Cc: "David Wheeler" <dwheeler ida org>
- Subject: Re: [gtk-list] Glib proposal: add strlcpy and strlcat to glib
- Date: 24 Apr 2000 08:18:18 -0400
[note that gtk-devel-list is the proper list for this]
"David Wheeler" <dwheeler@ida.org> writes:
> Greetings. I proposing adding the "strlcpy" and "strlcat" functions to
> the glib "String Utility Functions" as functions "g_strlcpy" and "g_strlcat".
>
> These functions support using fixed-length string buffers in a
> safer & easier manner than using strncpy/strncat. They're a key ingredient
> in OpenBSD's thrust to make their OS secure. Having these functions
> available makes it easier to create secure code and to avoid bugs.
> The functions strlcpy/strlcat aren't available everywhere, so putting
> them in glib simplifies porting.
>
g_strndup (), g_snprintf (), and g_strconcat () already guarantee
NULL-termination.
I guess the real question is whether we want strcpy and strcat in
addition to the versions that return new memory. If we want those,
then the NULL-terminating versions are more consistent with standard
glib behavior.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]