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 6769490..8718a48 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 7866999..15e3ebd 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 */