Fix the size of a strncpy

It seems that the intent of this code was to only use the first char[24]
in `addrs` for this strncpy. While that should always happen anyway
(inet_ntoa should never produce a >= 24 char string), the mismatch
between the size of poop->addrs[0] and `sizeof(poop->addrs)` caused
issues with FORTIFY on clang.
This commit is contained in:
George Burgess IV 2018-01-05 23:12:30 +00:00 committed by Mike Frysinger
parent 31f56e021f
commit 74922ad47b
1 changed files with 1 additions and 1 deletions

View File

@ -411,7 +411,7 @@ HINF * gethostpoop (name, numeric)
} else { /* not INADDR_NONE: numeric addresses... */
memcpy (poop->iaddrs, &iaddr, sizeof (IA));
strncpy (poop->addrs[0], inet_ntoa (iaddr), sizeof (poop->addrs));
strncpy (poop->addrs[0], inet_ntoa (iaddr), sizeof (poop->addrs[0]));
if (numeric) /* if numeric-only, we're done */
return (poop);
if (! o_verbose) /* likewise if we don't want */