diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c index 0edaae326..5eb747d82 100644 --- a/appl/ftp/ftp/ftp.c +++ b/appl/ftp/ftp/ftp.c @@ -60,7 +60,7 @@ hookup(char *host, int port) int s, len, tos; static char hostnamebuf[80]; - memset((char *)&hisctladdr, 0, sizeof (hisctladdr)); + memset(&hisctladdr, 0, sizeof (hisctladdr)); hisctladdr.sin_addr.s_addr = inet_addr(host); if (hisctladdr.sin_addr.s_addr != INADDR_NONE) { hisctladdr.sin_family = AF_INET; @@ -73,9 +73,9 @@ hookup(char *host, int port) return ((char *) 0); } hisctladdr.sin_family = hp->h_addrtype; - memmove((caddr_t)&hisctladdr.sin_addr, - hp->h_addr_list[0], hp->h_length); - memcpy(&hisctladdr.sin_addr, hp->h_addr, hp->h_length); + memmove(&hisctladdr.sin_addr, + hp->h_addr_list[0], + sizeof(hisctladdr.sin_addr)); strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf)); } hostname = hostnamebuf; @@ -95,8 +95,9 @@ hookup(char *host, int port) errno = oerrno; warn("connect to address %s", ia); hp->h_addr_list++; - memmove((caddr_t)&hisctladdr.sin_addr, - hp->h_addr_list[0], hp->h_length); + memmove(&hisctladdr.sin_addr, + hp->h_addr_list[0], + sizeof(hisctladdr.sin_addr)); fprintf(stdout, "Trying %s...\n", inet_ntoa(hisctladdr.sin_addr)); close(s); diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c index 06ee6795d..ca4cb611c 100644 --- a/appl/ftp/ftpd/ftpd.c +++ b/appl/ftp/ftpd/ftpd.c @@ -1621,16 +1621,6 @@ renamecmd(char *from, char *to) static void dolog(struct sockaddr_in *sin) { -#if 0 - struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr, - sizeof(struct in_addr), AF_INET); - - if (hp) - strncpy(remotehost, hp->h_name, sizeof(remotehost)); - else - strncpy(remotehost, inet_ntoa(sin->sin_addr), - sizeof(remotehost)); -#endif inaddr2str (sin->sin_addr, remotehost, sizeof(remotehost)); #ifdef HAVE_SETPROCTITLE sprintf(proctitle, "%s: connected", remotehost); diff --git a/appl/kx/common.c b/appl/kx/common.c index 75f05f511..6121908f8 100644 --- a/appl/kx/common.c +++ b/appl/kx/common.c @@ -150,7 +150,7 @@ get_xsockets (int *unix_socket, int *tcp_socket) h = gethostbyname ("localhost"); if (h) - memcpy (&local, h->h_addr, h->h_length); + memcpy (&local, h->h_addr, sizeof(local)); else local.s_addr = INADDR_LOOPBACK; diff --git a/appl/kx/kx.c b/appl/kx/kx.c index 2d39a3984..f08367038 100644 --- a/appl/kx/kx.c +++ b/appl/kx/kx.c @@ -128,7 +128,7 @@ connect_host (char *host, char *user, des_cblock *key, for(p = hostent->h_addr_list; *p; ++p) { int one = 1; - memcpy (&thataddr.sin_addr, *p, hostent->h_length); + memcpy (&thataddr.sin_addr, *p, sizeof(thataddr.sin_addr)); s = socket (AF_INET, SOCK_STREAM, 0); if (s < 0) { diff --git a/appl/popper/pop_init.c b/appl/popper/pop_init.c index baccd2617..43b5899f5 100644 --- a/appl/popper/pop_init.c +++ b/appl/popper/pop_init.c @@ -162,7 +162,7 @@ pop_init(POP *p,int argcount,char **argmessage) p->ipport = ntohs(cs.sin_port); /* Get the canonical name of the host to whom I am speaking */ - ch = gethostbyaddr((char *) &cs.sin_addr, sizeof(cs.sin_addr), AF_INET); + ch = gethostbyaddr(&cs.sin_addr, sizeof(cs.sin_addr), AF_INET); if (ch == NULL){ pop_log(p,POP_PRIORITY, "Unable to get canonical name of client, err = %d",errno); diff --git a/appl/telnet/telnet/commands.c b/appl/telnet/telnet/commands.c index 8132e53ed..4636d02dc 100644 --- a/appl/telnet/telnet/commands.c +++ b/appl/telnet/telnet/commands.c @@ -2255,10 +2255,11 @@ int tn(int argc, char **argv) if (host) { sin.sin_family = host->h_addrtype; #if defined(h_addr) /* In 4.3, this is a #define */ - memmove((caddr_t)&sin.sin_addr, - host->h_addr_list[0], host->h_length); + memmove(&sin.sin_addr, + host->h_addr_list[0], + sizeof(sin.sin_addr)); #else /* defined(h_addr) */ - memmove((caddr_t)&sin.sin_addr, host->h_addr, host->h_length); + memmove(&sin.sin_addr, host->h_addr, sizeof(sin.sin_addr)); #endif /* defined(h_addr) */ strncpy(_hostname, host->h_name, sizeof(_hostname)); _hostname[sizeof(_hostname)-1] = '\0'; @@ -2351,8 +2352,9 @@ int tn(int argc, char **argv) errno = oerrno; perror((char *)0); host->h_addr_list++; - memmove((caddr_t)&sin.sin_addr, - host->h_addr_list[0], host->h_length); + memmove(&sin.sin_addr, + host->h_addr_list[0], + sizeof(sin.sin_addr)); NetClose(net); continue; } @@ -2718,10 +2720,12 @@ sourceroute(arg, cpp, lenp) sin_addr.s_addr = tmp; } else if (host = gethostbyname(cp)) { #if defined(h_addr) - memmove((caddr_t)&sin_addr, - host->h_addr_list[0], host->h_length); + memmove(&sin_addr, + host->h_addr_list[0], + sizeof(sin_addr)); #else - memmove((caddr_t)&sin_addr, host->h_addr, host->h_length); + memmove(&sin_addr, host->h_addr, + sizeof(sin_addr)); #endif } else { *cpp = cp; diff --git a/lib/roken/inaddr2str.c b/lib/roken/inaddr2str.c index 7075e5b9c..e5d134b41 100644 --- a/lib/roken/inaddr2str.c +++ b/lib/roken/inaddr2str.c @@ -68,7 +68,7 @@ inaddr2str(struct in_addr addr, char *s, size_t len) h = gethostbyname (h->h_name); if(h) while ((p = *(h->h_addr_list)++)) - if (memcmp (p, &addr, h->h_length) == 0) { + if (memcmp (p, &addr, sizeof(addr)) == 0) { strncpy (s, h->h_name, len); s[len - 1] = '\0'; return; diff --git a/lib/roken/iruserok.c b/lib/roken/iruserok.c index 9094d442d..b5737785c 100644 --- a/lib/roken/iruserok.c +++ b/lib/roken/iruserok.c @@ -100,8 +100,9 @@ __ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser) #define ypdomain NULL #endif /* We need to get the damn hostname back for netgroup matching. */ - if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long), - AF_INET)) == NULL) + if ((hp = gethostbyaddr((char *)&raddr, + sizeof(u_long), + AF_INET)) == NULL) return (-1); strncpy(hname, hp->h_name, sizeof(hname)); hname[sizeof(hname) - 1] = '\0';