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:
parent
31f56e021f
commit
74922ad47b
2
netcat.c
2
netcat.c
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue