diff options
author | Xin LI <delphij@FreeBSD.org> | 2007-06-14 07:13:28 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2007-06-14 07:13:28 +0000 |
commit | 0bb263df82e129f5f8c82da6deb55dfe10daa677 (patch) | |
tree | 5499a5a1c9adc888dfad16a42918098269cca4c5 /lib | |
parent | a7429823788ea244b1bfb57a0a6ffc9da8885c84 (diff) | |
download | src-0bb263df82e129f5f8c82da6deb55dfe10daa677.tar.gz src-0bb263df82e129f5f8c82da6deb55dfe10daa677.zip |
Require users to provide a length information for inet_ntoa_r,
this is common on other platforms.
Reported by: pointyhat via kris
Notes
Notes:
svn path=/head/; revision=170715
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/inet/inet_ntoa.c | 7 | ||||
-rw-r--r-- | lib/libc/net/inet.3 | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/libc/inet/inet_ntoa.c b/lib/libc/inet/inet_ntoa.c index b75a983a523a..f5d69fac583c 100644 --- a/lib/libc/inet/inet_ntoa.c +++ b/lib/libc/inet/inet_ntoa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * @@ -60,9 +60,10 @@ inet_ntoa(struct in_addr in) { } char * -inet_ntoa_r(struct in_addr in, char *buf) +inet_ntoa_r(struct in_addr in, char *buf, socklen_t size) { - (void) inet_ntop(AF_INET, &in, buf, sizeof("255.255.255.255")); + + (void) inet_ntop(AF_INET, &in, buf, size); return (buf); } diff --git a/lib/libc/net/inet.3 b/lib/libc/net/inet.3 index d6428c90142c..af48143d9f68 100644 --- a/lib/libc/net/inet.3 +++ b/lib/libc/net/inet.3 @@ -28,7 +28,7 @@ .\" From: @(#)inet.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 11, 2007 +.Dd June 14, 2007 .Dt INET 3 .Os .Sh NAME @@ -62,6 +62,7 @@ .Fo inet_ntoa_r .Fa "struct in_addr in" .Fa "char *buf" +.Fa "socklen_t size" .Fc .Ft const char * .Fo inet_ntop @@ -156,7 +157,6 @@ The routine .Fn inet_ntoa_r is the reentrant version of .Fn inet_ntoa . -It requires a buffer large enough to contain an IPv4 address. The routine .Fn inet_makeaddr takes an Internet network number and a local |