summaryrefslogtreecommitdiff
path: root/lib/libc/net/getaddrinfo.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@FreeBSD.org>2000-07-09 06:10:01 +0000
committerJun-ichiro itojun Hagino <itojun@FreeBSD.org>2000-07-09 06:10:01 +0000
commitec20fe00cc4b2e7f6a0037add994faa80796e275 (patch)
tree129182575cf14e82ca044fc857d974b28169fccf /lib/libc/net/getaddrinfo.c
parent39b31d1322dc4180cc7f93366e2bec0e8c748209 (diff)
Notes
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r--lib/libc/net/getaddrinfo.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 44a745f1231a..f44a14d79919 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: getaddrinfo.c,v 1.10 2000/07/05 02:59:28 itojun Exp $ */
+/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -359,13 +359,16 @@ static int
str_isnumber(p)
const char *p;
{
- const char *q = (const char *)p;
- while (*q) {
- if (!isdigit(*q))
- return NO;
- q++;
- }
- return YES;
+ char *ep;
+
+ if (*p == '\0')
+ return NO;
+ ep = NULL;
+ (void)strtoul(p, &ep, 10);
+ if (ep && *ep == '\0')
+ return YES;
+ else
+ return NO;
}
int
@@ -1171,6 +1174,10 @@ ip6_str2scopeid(scope, sin6)
struct in6_addr *a6 = &sin6->sin6_addr;
char *ep;
+ /* empty scopeid portion is invalid */
+ if (*scope == '\0')
+ return -1;
+
if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) {
/*
* We currently assume a one-to-one mapping between links