diff options
author | wpaul <wpaul@FreeBSD.org> | 1996-12-27 18:21:07 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1996-12-27 18:21:07 +0000 |
commit | 7187ede0636788711d157314ae5b131815515a80 (patch) | |
tree | 775c627300a0c60282f7459ec5e82dbc339a1dd7 /lib/libc/net/ether_addr.c | |
parent | 3d869b9c34726691683c118cd61329ee5a519a69 (diff) | |
download | FreeBSD-src-7187ede0636788711d157314ae5b131815515a80.zip FreeBSD-src-7187ede0636788711d157314ae5b131815515a80.tar.gz |
Small yet significant tweaks/cleanups:
- getservent:
o put _yp_check() proto under #ifdef YP where it belongs
o local YP buffers should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying
- gethostbynis:
o local YP buffer should be YPMAXRECORD + 2 bytes long
- getnetbynis:
o local YP buffer should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying
- ether_addr:
o local YP buffers should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying (in this case it's BUFSIZ + 2 bytes,
but it happens that BUFSIZ == YPMAXRECORD.
- gethostbydns:
o nuke stray 'return(NULL)' in __dns_getanswer() (harmless but looks silly)
These are 2.2 candidates. I will wait a few days to make sure these don't
break anything and then, if there are no objections, move them to the 2.2
branch.
Diffstat (limited to 'lib/libc/net/ether_addr.c')
-rw-r--r-- | lib/libc/net/ether_addr.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/net/ether_addr.c b/lib/libc/net/ether_addr.c index a6f77ab..f2caeea 100644 --- a/lib/libc/net/ether_addr.c +++ b/lib/libc/net/ether_addr.c @@ -35,7 +35,7 @@ * Center for Telecommunications Research * Columbia University, New York City * - * $Id: ether_addr.c,v 1.5 1996/12/05 18:46:19 jkh Exp $ + * $Id: ether_addr.c,v 1.6 1996/12/10 17:19:09 wollman Exp $ */ @@ -132,7 +132,7 @@ int ether_ntohost(hostname, e) struct ether_addr *e; { FILE *fp; - char buf[BUFSIZ]; + char buf[BUFSIZ + 2]; struct ether_addr local_ether; char local_host[MAXHOSTNAMELEN]; #ifdef YP @@ -157,7 +157,8 @@ int ether_ntohost(hostname, e) continue; } strncpy(buf, result, resultlen); - free(result); + buf[resultlen] = '\0'; + free(result); } #endif if (!ether_line(buf, &local_ether, local_host)) { @@ -183,7 +184,7 @@ int ether_hostton(hostname, e) struct ether_addr *e; { FILE *fp; - char buf[BUFSIZ]; + char buf[BUFSIZ + 2]; struct ether_addr local_ether; char local_host[MAXHOSTNAMELEN]; #ifdef YP @@ -206,6 +207,7 @@ int ether_hostton(hostname, e) continue; } strncpy(buf, result, resultlen); + buf[resultlen] = '\0'; free(result); } #endif |