summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>1997-04-29 19:15:46 +0000
committerderaadt <>1997-04-29 19:15:46 +0000
commit4d501a10865093c49a37e193a5f70445ff89a3d7 (patch)
tree8bdb40ab9bb1c87ede696a26fcc4772de3089236
parent7eb278cd2038b8232e8e27005805ef473a928586 (diff)
downloadopenbsd-4d501a10865093c49a37e193a5f70445ff89a3d7.tar.gz
openbsd-4d501a10865093c49a37e193a5f70445ff89a3d7.tar.bz2
openbsd-4d501a10865093c49a37e193a5f70445ff89a3d7.zip
careful buffer handling
-rw-r--r--src/lib/libc/net/gethostnamadr.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c
index ae2cd7c91f..ddf8d35528 100644
--- a/src/lib/libc/net/gethostnamadr.c
+++ b/src/lib/libc/net/gethostnamadr.c
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54#if defined(LIBC_SCCS) && !defined(lint) 54#if defined(LIBC_SCCS) && !defined(lint)
55static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.23 1997/04/27 22:20:47 deraadt Exp $"; 55static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.24 1997/04/29 19:15:46 deraadt Exp $";
56#endif /* LIBC_SCCS and not lint */ 56#endif /* LIBC_SCCS and not lint */
57 57
58#include <sys/param.h> 58#include <sys/param.h>
@@ -503,10 +503,10 @@ gethostbyname2(name, af)
503 h_errno = HOST_NOT_FOUND; 503 h_errno = HOST_NOT_FOUND;
504 return (NULL); 504 return (NULL);
505 } 505 }
506 strncpy(hostbuf, name, MAXDNAME); 506 strncpy(hostbuf, name, MAXHOSTNAME-1);
507 hostbuf[MAXDNAME] = '\0'; 507 hostbuf[MAXHOSTNAME-1] = '\0';
508 bp = hostbuf + MAXDNAME; 508 bp = hostbuf + MAXHOSTNAME;
509 len = sizeof hostbuf - MAXDNAME; 509 len = sizeof hostbuf - MAXHOSTNAME;
510 host.h_name = hostbuf; 510 host.h_name = hostbuf;
511 host.h_aliases = host_aliases; 511 host.h_aliases = host_aliases;
512 host_aliases[0] = NULL; 512 host_aliases[0] = NULL;
@@ -536,10 +536,10 @@ gethostbyname2(name, af)
536 h_errno = HOST_NOT_FOUND; 536 h_errno = HOST_NOT_FOUND;
537 return (NULL); 537 return (NULL);
538 } 538 }
539 strncpy(hostbuf, name, MAXDNAME); 539 strncpy(hostbuf, name, MAXHOSTNAME-1);
540 hostbuf[MAXDNAME] = '\0'; 540 hostbuf[MAXHOSTNAME-1] = '\0';
541 bp = hostbuf + MAXDNAME; 541 bp = hostbuf + MAXHOSTNAME;
542 len = sizeof hostbuf - MAXDNAME; 542 len = sizeof hostbuf - MAXHOSTNAME;
543 host.h_name = hostbuf; 543 host.h_name = hostbuf;
544 host.h_aliases = host_aliases; 544 host.h_aliases = host_aliases;
545 host_aliases[0] = NULL; 545 host_aliases[0] = NULL;