From 83e49bd036d362eb626afa0aef347c08df3b72be Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 26 Jul 2000 03:51:07 +0000 Subject: added g_strlcat() and g_strlcpy() wrappers, supplied by David Wheeler Wed Jul 26 05:47:48 2000 Tim Janik * configure.in: * testglib.c: * gstrfuncs.c: * glib.h: added g_strlcat() and g_strlcpy() wrappers, supplied by David Wheeler : * glib.h, gstrfuncs.c: added g_strlcpy and g_strlcat to support safe manipulation of fixed-length string buffers. These functions were originally developed by Todd Miller to simplify development of security-related programs, and are available on many (but not all) Unix-like systems, including OpenBSD, FreeBSD, and Solaris. See ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcpy.3 and http://www.openbsd.org/security.html. If there's a strlcpy/strlcat on the system, it's called, otherwise an implementation is provided. * testglib.c: Added tests for g_strlcpy, g_strlcat. --- glib.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'glib.h') diff --git a/glib.h b/glib.h index 7f31ba9e0..bbc23dc25 100644 --- a/glib.h +++ b/glib.h @@ -1654,6 +1654,12 @@ gint g_strncasecmp (const gchar *s1, gchar* g_strdown (gchar *string); gchar* g_strup (gchar *string); gchar* g_strreverse (gchar *string); +gsize g_strlcpy (gchar *dest, + const gchar *src, + gsize dest_size); +gsize g_strlcat (gchar *dest, + const gchar *src, + gsize dest_size); /* removes leading spaces */ gchar* g_strchug (gchar *string); /* removes trailing spaces */ -- cgit v1.2.3