From ab637a79ad2efe9285d301f23c91eb38185b4344 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 5 May 2024 18:47:17 -0700 Subject: [PATCH 2/2] Fix sc_bsd_caddr checks. * libinetutils/if_index.c (if_nameindex): Don't cast non-void pointer arithmetic. * ftp/ftp.c (hookup): Don't cast pointers to memmove and memset. * src/inetd.c (getconfigent): Likewise. * telnet/commands.c (tn): Likewise. --- ftp/ftp.c | 2 +- libinetutils/if_index.c | 2 +- src/inetd.c | 4 ++-- telnet/commands.c | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ftp/ftp.c b/ftp/ftp.c index ca0eae6e..74232afc 100644 --- a/ftp/ftp.c +++ b/ftp/ftp.c @@ -219,7 +219,7 @@ hookup (char *host, int port) sizeof (timeout)); ctladdrlen = ai->ai_addrlen; - memmove ((caddr_t) & hisctladdr, ai->ai_addr, ai->ai_addrlen); + memmove (&hisctladdr, ai->ai_addr, ai->ai_addrlen); break; } /* for (ai = ai->ai_next) */ diff --git a/libinetutils/if_index.c b/libinetutils/if_index.c index ac1f27a8..3b8c4307 100644 --- a/libinetutils/if_index.c +++ b/libinetutils/if_index.c @@ -125,7 +125,7 @@ if_nameindex (void) i = 0; ifr = (struct ifreq *) ifc.ifc_req; - end = (struct ifreq *) ((caddr_t) ifr + ifc.ifc_len); + end = (struct ifreq *) (ifr + ifc.ifc_len); while (ifr < end) { cur = ifr; diff --git a/src/inetd.c b/src/inetd.c index 2d2bd52d..aa7be731 100644 --- a/src/inetd.c +++ b/src/inetd.c @@ -994,13 +994,13 @@ getconfigent (FILE *fconfig, const char *file, size_t *line) if (serv_node) return next_node_sep (sep); - memset ((caddr_t) sep, 0, sizeof *sep); + memset (sep, 0, sizeof *sep); while (1) { argcv_free (argc, argv); freeconfig (sep); - memset ((caddr_t) sep, 0, sizeof *sep); + memset (sep, 0, sizeof *sep); do { diff --git a/telnet/commands.c b/telnet/commands.c index 1288fdbd..2212c7f3 100644 --- a/telnet/commands.c +++ b/telnet/commands.c @@ -2820,8 +2820,7 @@ 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], host->h_length); close (net); continue; } -- 2.45.0