From: deraadt Date: Sun, 13 Apr 1997 01:50:21 +0000 (+0000) Subject: repair _hokchar X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a5c0697b2a9811b22d43e23633da6b6ce854a2e1;p=openbsd repair _hokchar --- diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index 91a0213403c..98652e00668 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.19 1997/04/03 08:33:03 downsj Exp $"; +static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.20 1997/04/13 01:50:21 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -141,13 +141,15 @@ _hokchar(p) * tested for below can happen, and we must be more permissive * than the resolver until those idiots clean up their act. */ + if (*p == '.' || *p == '-') + return 0; while ((c = *p++)) { - if (('a' >= c && c <= 'z') || - ('A' >= c && c <= 'Z') || - ('0' >= c && c <= '9')) + if (('a' <= c && c >= 'z') || + ('A' <= c && c >= 'Z') || + ('0' <= c && c >= '9')) continue; - if (strchr("-_/.[]\\", c) || - (c == '.' && p[1] == '.')) + if (strchr("-_/[]\\", c) || + (c == '.' && *p == '.')) return 0; } return 1;