diff options
author | wpaul <wpaul@FreeBSD.org> | 1996-12-24 17:01:49 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1996-12-24 17:01:49 +0000 |
commit | d594a0a4463e72746f58f6f7c37f42b684060387 (patch) | |
tree | 4c68fd180f5a6e67f6e589292727564ced1f0736 /lib/libc/net | |
parent | 3d44e7b8d16a8feef39fd95bf30fa136b1fdb71a (diff) | |
download | FreeBSD-src-d594a0a4463e72746f58f6f7c37f42b684060387.zip FreeBSD-src-d594a0a4463e72746f58f6f7c37f42b684060387.tar.gz |
Another one-liner: remember to NUL terminate local copy of NIS host
lookup results. Without this, doing multiple host/addr lookups in a
single process yeilds strange results (the buffer is static, and
garbage may be left behind from previous lookups).
I just noticed this in 2.2-BETA. Unless somebody threatens to chop my
hands off with an axe, I'm going to move this to the 2.2-RELENG branch
shortly.
Diffstat (limited to 'lib/libc/net')
-rw-r--r-- | lib/libc/net/gethostbynis.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c index 24be897..c1f15e6 100644 --- a/lib/libc/net/gethostbynis.c +++ b/lib/libc/net/gethostbynis.c @@ -24,8 +24,8 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.3 1996/07/12 18:54:35 jkh Exp $"; -static char rcsid[] = "$Id: gethostbynis.c,v 1.3 1996/07/12 18:54:35 jkh Exp $"; +static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.4 1996/08/29 20:07:54 peter Exp $"; +static char rcsid[] = "$Id: gethostbynis.c,v 1.4 1996/08/29 20:07:54 peter Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -85,6 +85,7 @@ _gethostbynis(name, map, af) /* avoid potential memory leak */ bcopy((char *)result, (char *)&ypbuf, resultlen); + ypbuf[resultlen] = '\0'; free(result); result = (char *)&ypbuf; |