summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ns_addr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/ns_addr.c')
-rw-r--r--src/lib/libc/net/ns_addr.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/lib/libc/net/ns_addr.c b/src/lib/libc/net/ns_addr.c
index f75ddb23b7..0d1b45858f 100644
--- a/src/lib/libc/net/ns_addr.c
+++ b/src/lib/libc/net/ns_addr.c
@@ -1,5 +1,3 @@
1/* $NetBSD: ns_addr.c,v 1.5 1995/02/25 06:20:51 cgd Exp $ */
2
3/* 1/*
4 * Copyright (c) 1986, 1993 2 * Copyright (c) 1986, 1993
5 * The Regents of the University of California. All rights reserved. 3 * The Regents of the University of California. All rights reserved.
@@ -37,11 +35,7 @@
37 */ 35 */
38 36
39#if defined(LIBC_SCCS) && !defined(lint) 37#if defined(LIBC_SCCS) && !defined(lint)
40#if 0 38static char rcsid[] = "$OpenBSD: ns_addr.c,v 1.7 2002/02/16 21:27:23 millert Exp $";
41static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93";
42#else
43static char rcsid[] = "$NetBSD: ns_addr.c,v 1.5 1995/02/25 06:20:51 cgd Exp $";
44#endif
45#endif /* LIBC_SCCS and not lint */ 39#endif /* LIBC_SCCS and not lint */
46 40
47#include <sys/param.h> 41#include <sys/param.h>
@@ -51,7 +45,8 @@ static char rcsid[] = "$NetBSD: ns_addr.c,v 1.5 1995/02/25 06:20:51 cgd Exp $";
51 45
52static struct ns_addr addr, zero_addr; 46static struct ns_addr addr, zero_addr;
53 47
54static void Field(), cvtbase(); 48static void Field(char *, u_int8_t *, int);
49static void cvtbase(long, int, int[], int, u_int8_t[], int);
55 50
56struct ns_addr 51struct ns_addr
57ns_addr(name) 52ns_addr(name)
@@ -61,16 +56,15 @@ ns_addr(name)
61 char *hostname, *socketname, *cp; 56 char *hostname, *socketname, *cp;
62 char buf[50]; 57 char buf[50];
63 58
64 (void)strncpy(buf, name, sizeof(buf) - 1); 59 strlcpy(buf, name, sizeof(buf));
65 buf[sizeof(buf) - 1] = '\0';
66 60
67 /* 61 /*
68 * First, figure out what he intends as a field separtor. 62 * First, figure out what he intends as a field separtor.
69 * Despite the way this routine is written, the prefered 63 * Despite the way this routine is written, the prefered
70 * form 2-272.AA001234H.01777, i.e. XDE standard. 64 * form 2-272.AA001234H.01777, i.e. XDE standard.
71 * Great efforts are made to insure backward compatability. 65 * Great efforts are made to insure backward compatibility.
72 */ 66 */
73 if (hostname = strchr(buf, '#')) 67 if ((hostname = strchr(buf, '#')))
74 separator = '#'; 68 separator = '#';
75 else { 69 else {
76 hostname = strchr(buf, '.'); 70 hostname = strchr(buf, '.');
@@ -95,7 +89,7 @@ ns_addr(name)
95 Field(socketname, (u_char *)&addr.x_port, 2); 89 Field(socketname, (u_char *)&addr.x_port, 2);
96 } 90 }
97 91
98 Field(hostname, addr.x_host.c_host, 6); 92 Field(hostname, (u_char *)addr.x_host.c_host, 6);
99 93
100 return (addr); 94 return (addr);
101} 95}