diff options
author | deraadt <> | 1997-04-15 11:27:56 +0000 |
---|---|---|
committer | deraadt <> | 1997-04-15 11:27:56 +0000 |
commit | f08f24c59f7251b79135ecd1a0827946bce8b43a (patch) | |
tree | efc43cf4f44e221767f1b5f4386dd92b7f61fac2 | |
parent | b972b7826531c0800f547de46051a6b90b859822 (diff) | |
download | openbsd-f08f24c59f7251b79135ecd1a0827946bce8b43a.tar.gz openbsd-f08f24c59f7251b79135ecd1a0827946bce8b43a.tar.bz2 openbsd-f08f24c59f7251b79135ecd1a0827946bce8b43a.zip |
correct the paranoia check
-rw-r--r-- | src/lib/libc/net/gethostnamadr.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c index 7ce0f9c3bd..95e00484d6 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) |
55 | static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.21 1997/04/14 06:57:44 deraadt Exp $"; | 55 | static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.22 1997/04/15 11:27:56 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> |
@@ -140,15 +140,18 @@ _hokchar(p) | |||
140 | * characters are a-z, A-Z, 0-9, '-' and . But the others | 140 | * characters are a-z, A-Z, 0-9, '-' and . But the others |
141 | * tested for below can happen, and we must be more permissive | 141 | * tested for below can happen, and we must be more permissive |
142 | * than the resolver until those idiots clean up their act. | 142 | * than the resolver until those idiots clean up their act. |
143 | * We let '/' through, but not '..' | ||
143 | */ | 144 | */ |
144 | while ((c = *p++)) { | 145 | while ((c = *p++)) { |
145 | if (('a' >= c && c <= 'z') || | 146 | if (('a' <= c && c <= 'z') || |
146 | ('A' >= c && c <= 'Z') || | 147 | ('A' <= c && c <= 'Z') || |
147 | ('0' >= c && c <= '9')) | 148 | ('0' <= c && c <= '9')) |
148 | continue; | 149 | continue; |
149 | if (strchr("-_/.[]\\", c) || | 150 | if (strchr("-_/", c)) |
150 | (c == '.' && p[1] == '.')) | 151 | continue; |
151 | return 0; | 152 | if (c == '.' && *p != '.') |
153 | continue; | ||
154 | return 0; | ||
152 | } | 155 | } |
153 | return 1; | 156 | return 1; |
154 | } | 157 | } |