diff options
Diffstat (limited to 'inet')
-rw-r--r-- | inet/bits/inet-fortified.h | 8 | ||||
-rw-r--r-- | inet/inet_ntoa.c | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/inet/bits/inet-fortified.h b/inet/bits/inet-fortified.h index 6738221..cc476eb 100644 --- a/inet/bits/inet-fortified.h +++ b/inet/bits/inet-fortified.h @@ -45,15 +45,15 @@ __NTH (inet_pton (int __af, __fortify_clang_warning_only_if_bos0_lt (4, __dst, "inet_pton called with destination buffer size less than 4") { - size_t sz = 0; + size_t __sz = 0; if (__af == AF_INET) - sz = sizeof (struct in_addr); + __sz = sizeof (struct in_addr); else if (__af == AF_INET6) - sz = sizeof (struct in6_addr); + __sz = sizeof (struct in6_addr); else return __inet_pton_alias (__af, __src, __dst); - return __glibc_fortify (inet_pton, sz, sizeof (char), + return __glibc_fortify (inet_pton, __sz, sizeof (char), __glibc_objsize (__dst), __af, __src, __dst); }; diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c index a4543f6..2efd24e 100644 --- a/inet/inet_ntoa.c +++ b/inet/inet_ntoa.c @@ -23,15 +23,12 @@ /* The interface of this function is completely stupid, it requires a static buffer. We relax this a bit in that we allow one buffer for each thread. */ -static __thread char buffer[18]; +static __thread char buffer[INET_ADDRSTRLEN]; char * inet_ntoa (struct in_addr in) { - unsigned char *bytes = (unsigned char *) ∈ - __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d", - bytes[0], bytes[1], bytes[2], bytes[3]); - + __inet_ntop (AF_INET, &in, buffer, sizeof buffer); return buffer; } |