summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/string.c b/string.c
index e50716a..9a1cb60 100644
--- a/string.c
+++ b/string.c
@@ -26,6 +26,22 @@ char *__strncat_chk(char *dest, const char *src, size_t n, size_t destlen)
return strncat(dest, src, n);
}
+/* "Checked" strcat */
+char *__strcat_chk(char *dest, const char *src, size_t destlen)
+{
+ return strncat(dest, src, destlen - 1);
+}
+
+/* "Checked" strncpy */
+char *__strncpy_chk(char *dest, const char *src, size_t n, size_t destlen)
+{
+ assert(dest != NULL);
+ assert(src != NULL);
+ assert(strlen(src) < destlen);
+
+ return strncpy(dest, src, n);
+}
+
/* "Checked" strcpy */
char *__strcpy_chk(char *dest, const char *src, size_t destlen)
{