diff options
Diffstat (limited to 'src/lib/libc/net/ns_addr.c')
-rw-r--r-- | src/lib/libc/net/ns_addr.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/lib/libc/net/ns_addr.c b/src/lib/libc/net/ns_addr.c index f75ddb23b7..0f8feda55c 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. |
@@ -15,11 +13,7 @@ | |||
15 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. |
18 | * 3. All advertising materials mentioning features or use of this software | 16 | * 3. Neither the name of the University nor the names of its contributors |
19 | * must display the following acknowledgement: | ||
20 | * This product includes software developed by the University of | ||
21 | * California, Berkeley and its contributors. | ||
22 | * 4. Neither the name of the University nor the names of its contributors | ||
23 | * may be used to endorse or promote products derived from this software | 17 | * may be used to endorse or promote products derived from this software |
24 | * without specific prior written permission. | 18 | * without specific prior written permission. |
25 | * | 19 | * |
@@ -37,11 +31,7 @@ | |||
37 | */ | 31 | */ |
38 | 32 | ||
39 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
40 | #if 0 | 34 | static char rcsid[] = "$OpenBSD: ns_addr.c,v 1.8 2003/06/02 20:18:35 millert Exp $"; |
41 | static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93"; | ||
42 | #else | ||
43 | static 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 */ | 35 | #endif /* LIBC_SCCS and not lint */ |
46 | 36 | ||
47 | #include <sys/param.h> | 37 | #include <sys/param.h> |
@@ -51,7 +41,8 @@ static char rcsid[] = "$NetBSD: ns_addr.c,v 1.5 1995/02/25 06:20:51 cgd Exp $"; | |||
51 | 41 | ||
52 | static struct ns_addr addr, zero_addr; | 42 | static struct ns_addr addr, zero_addr; |
53 | 43 | ||
54 | static void Field(), cvtbase(); | 44 | static void Field(char *, u_int8_t *, int); |
45 | static void cvtbase(long, int, int[], int, u_int8_t[], int); | ||
55 | 46 | ||
56 | struct ns_addr | 47 | struct ns_addr |
57 | ns_addr(name) | 48 | ns_addr(name) |
@@ -61,16 +52,15 @@ ns_addr(name) | |||
61 | char *hostname, *socketname, *cp; | 52 | char *hostname, *socketname, *cp; |
62 | char buf[50]; | 53 | char buf[50]; |
63 | 54 | ||
64 | (void)strncpy(buf, name, sizeof(buf) - 1); | 55 | strlcpy(buf, name, sizeof(buf)); |
65 | buf[sizeof(buf) - 1] = '\0'; | ||
66 | 56 | ||
67 | /* | 57 | /* |
68 | * First, figure out what he intends as a field separtor. | 58 | * First, figure out what he intends as a field separtor. |
69 | * Despite the way this routine is written, the prefered | 59 | * Despite the way this routine is written, the prefered |
70 | * form 2-272.AA001234H.01777, i.e. XDE standard. | 60 | * form 2-272.AA001234H.01777, i.e. XDE standard. |
71 | * Great efforts are made to insure backward compatability. | 61 | * Great efforts are made to insure backward compatibility. |
72 | */ | 62 | */ |
73 | if (hostname = strchr(buf, '#')) | 63 | if ((hostname = strchr(buf, '#'))) |
74 | separator = '#'; | 64 | separator = '#'; |
75 | else { | 65 | else { |
76 | hostname = strchr(buf, '.'); | 66 | hostname = strchr(buf, '.'); |
@@ -95,7 +85,7 @@ ns_addr(name) | |||
95 | Field(socketname, (u_char *)&addr.x_port, 2); | 85 | Field(socketname, (u_char *)&addr.x_port, 2); |
96 | } | 86 | } |
97 | 87 | ||
98 | Field(hostname, addr.x_host.c_host, 6); | 88 | Field(hostname, (u_char *)addr.x_host.c_host, 6); |
99 | 89 | ||
100 | return (addr); | 90 | return (addr); |
101 | } | 91 | } |