From 6dc6333323cce1ccc9aaec7ef9e7e200919204e1 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 26 Oct 2009 21:10:24 +0000 Subject: [PATCH] Use strlcpy instead of strncpy, pointed out by deraadt. --- xmalloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xmalloc.c b/xmalloc.c index 6bf63bef..5eb5c4a8 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -29,13 +29,14 @@ char * xstrdup(const char *s) { - void *ptr; + char *ptr; size_t len; len = strlen(s) + 1; ptr = xmalloc(len); - return (strncpy(ptr, s, len)); + strlcpy(ptr, s, len); + return (ptr); } void *