Changed strcpy() calls into memcpy() calls.
authorWayne Davison <wayned@samba.org>
Fri, 13 Oct 2006 23:17:37 +0000 (23:17 +0000)
committerWayne Davison <wayned@samba.org>
Fri, 13 Oct 2006 23:17:37 +0000 (23:17 +0000)
lib/compat.c
lib/inet_ntop.c

index 6769490f69b9ea732f8e2ec09eadaf6b70394b35..8718a48f9992d661e53bed59c5a7510f35a8c1d7 100644 (file)
 #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
 
index 7866999a594c4f0bf324b7758af4255ed6d06621..15e3ebd32ea27a819acad8fa41b65eca53e4aff2 100644 (file)
@@ -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 */