wsutil/inet_addr: Add a cast to squelch a narrowing warning

This commit is contained in:
João Valverde 2021-12-27 21:37:56 +00:00 committed by Wireshark GitLab Utility
parent a566076839
commit 48bb9534d7
1 changed files with 3 additions and 1 deletions

View File

@ -62,7 +62,9 @@ static inline const char *
inet_ntop_internal(int af, const void *src, char *dst, size_t dst_size,
const char *af_str)
{
const char *ret = inet_ntop(af, _NTOP_SRC_CAST_ src, dst, dst_size);
/* Add a cast to ignore 64-to-32 bit narrowing warnings with some
* compilers (POSIX uses socklen_t instead of size_t). */
const char *ret = inet_ntop(af, _NTOP_SRC_CAST_ src, dst, (unsigned int)dst_size);
if (ret == NULL) {
int err = errno;
char errbuf[16];