From 204f4f4d091890d9106e744cffb9561e82df44ad Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 13 Oct 2006 23:17:37 +0000 Subject: [PATCH] Changed strcpy() calls into memcpy() calls. --- lib/compat.c | 10 +++++----- lib/inet_ntop.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/compat.c b/lib/compat.c index 6769490f..8718a48f 100644 --- a/lib/compat.c +++ b/lib/compat.c @@ -25,11 +25,11 @@ #ifndef HAVE_STRDUP char *strdup(char *s) { - int l = strlen(s) + 1; - char *ret = (char *)malloc(l); - if (ret) - strcpy(ret,s); - return ret; + int len = strlen(s) + 1; + char *ret = (char *)malloc(len); + if (ret) + memcpy(ret, s, len); + return ret; } #endif diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index 7866999a..15e3ebd3 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -81,7 +81,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size) errno = ENOSPC; return (NULL); } - strcpy(dst, tmp); + memcpy(dst, tmp, len + 1); return (dst); } @@ -178,7 +178,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size) errno = ENOSPC; return (NULL); } - strcpy(dst, tmp); + memcpy(dst, tmp, tp - tmp); return (dst); } #endif /* AF_INET6 */ -- 2.34.1