summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-04-29 19:15:46 +0000
committerderaadt <deraadt@openbsd.org>1997-04-29 19:15:46 +0000
commit2e9684adbe495bd5cd18e82475b283d50d72a75d (patch)
treecf0965d1799d472284b54aa17d2ed4e36b273b22 /lib/libc
parentMinor annoyance, synch with what we actually have in our conf directory: (diff)
downloadwireguard-openbsd-2e9684adbe495bd5cd18e82475b283d50d72a75d.tar.xz
wireguard-openbsd-2e9684adbe495bd5cd18e82475b283d50d72a75d.zip
careful buffer handling
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/gethostnamadr.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index ae2cd7c91fa..ddf8d355283 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -52,7 +52,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.23 1997/04/27 22:20:47 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.24 1997/04/29 19:15:46 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -503,10 +503,10 @@ gethostbyname2(name, af)
h_errno = HOST_NOT_FOUND;
return (NULL);
}
- strncpy(hostbuf, name, MAXDNAME);
- hostbuf[MAXDNAME] = '\0';
- bp = hostbuf + MAXDNAME;
- len = sizeof hostbuf - MAXDNAME;
+ strncpy(hostbuf, name, MAXHOSTNAME-1);
+ hostbuf[MAXHOSTNAME-1] = '\0';
+ bp = hostbuf + MAXHOSTNAME;
+ len = sizeof hostbuf - MAXHOSTNAME;
host.h_name = hostbuf;
host.h_aliases = host_aliases;
host_aliases[0] = NULL;
@@ -536,10 +536,10 @@ gethostbyname2(name, af)
h_errno = HOST_NOT_FOUND;
return (NULL);
}
- strncpy(hostbuf, name, MAXDNAME);
- hostbuf[MAXDNAME] = '\0';
- bp = hostbuf + MAXDNAME;
- len = sizeof hostbuf - MAXDNAME;
+ strncpy(hostbuf, name, MAXHOSTNAME-1);
+ hostbuf[MAXHOSTNAME-1] = '\0';
+ bp = hostbuf + MAXHOSTNAME;
+ len = sizeof hostbuf - MAXHOSTNAME;
host.h_name = hostbuf;
host.h_aliases = host_aliases;
host_aliases[0] = NULL;