Submitted by: Lidong Zhou <ldzhou@cs.cornell.edu>
[openssl.git] / crypto / bio / b_sock.c
index d29b29ff8b324a24bfa3c9d4045ef085a98d754b..561d16600495f0ef96702867672319fd65a042e4 100644 (file)
@@ -282,12 +282,12 @@ static struct hostent *ghbn_dup(struct hostent *a)
 
        j=strlen(a->h_name)+1;
        if ((ret->h_name=Malloc(j)) == NULL) goto err;
 
        j=strlen(a->h_name)+1;
        if ((ret->h_name=Malloc(j)) == NULL) goto err;
-       memcpy((char *)ret->h_name,a->h_name,j+1);
+       memcpy((char *)ret->h_name,a->h_name,j);
        for (i=0; a->h_aliases[i] != NULL; i++)
                {
                j=strlen(a->h_aliases[i])+1;
                if ((ret->h_aliases[i]=Malloc(j)) == NULL) goto err;
        for (i=0; a->h_aliases[i] != NULL; i++)
                {
                j=strlen(a->h_aliases[i])+1;
                if ((ret->h_aliases[i]=Malloc(j)) == NULL) goto err;
-               memcpy(ret->h_aliases[i],a->h_aliases[i],j+1);
+               memcpy(ret->h_aliases[i],a->h_aliases[i],j);
                }
        ret->h_length=a->h_length;
        ret->h_addrtype=a->h_addrtype;
                }
        ret->h_length=a->h_length;
        ret->h_addrtype=a->h_addrtype;