aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--liberty.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/liberty.c b/liberty.c
index 390d40b..b03e3fa 100644
--- a/liberty.c
+++ b/liberty.c
@@ -292,7 +292,8 @@ xreallocarray (void *o, size_t n, size_t m)
static char *
xstrdup (const char *s)
{
- return strcpy (xmalloc (strlen (s) + 1), s);
+ size_t len = strlen (s) + 1;
+ return memcpy (xmalloc (len), s, len);
}
static char *