diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index c64e838acc..a443d8c9f2 100644 --- a/src/lib/libc/net/getaddrinfo.c +++ b/src/lib/libc/net/getaddrinfo.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* $OpenBSD: getaddrinfo.c,v 1.24 2000/07/05 03:00:55 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.25 2000/07/09 04:48:35 itojun Exp $ */ |
| 2 | /* $KAME: getaddrinfo.c,v 1.25 2000/07/05 02:59:28 itojun Exp $ */ | 2 | /* $KAME: getaddrinfo.c,v 1.30 2000/07/09 04:37:25 itojun Exp $ */ |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| @@ -288,13 +288,16 @@ static int | |||
| 288 | str_isnumber(p) | 288 | str_isnumber(p) |
| 289 | const char *p; | 289 | const char *p; |
| 290 | { | 290 | { |
| 291 | const char *q = (const char *)p; | 291 | char *ep; |
| 292 | while (*q) { | 292 | |
| 293 | if (!isdigit(*q)) | 293 | if (*p == '\0') |
| 294 | return NO; | 294 | return NO; |
| 295 | q++; | 295 | ep = NULL; |
| 296 | } | 296 | (void)strtoul(p, &ep, 10); |
| 297 | return YES; | 297 | if (ep && *ep == '\0') |
| 298 | return YES; | ||
| 299 | else | ||
| 300 | return NO; | ||
| 298 | } | 301 | } |
| 299 | 302 | ||
| 300 | int | 303 | int |
| @@ -973,6 +976,10 @@ ip6_str2scopeid(scope, sin6) | |||
| 973 | struct in6_addr *a6 = &sin6->sin6_addr; | 976 | struct in6_addr *a6 = &sin6->sin6_addr; |
| 974 | char *ep; | 977 | char *ep; |
| 975 | 978 | ||
| 979 | /* empty scopeid portion is invalid */ | ||
| 980 | if (*scope == '\0') | ||
| 981 | return -1; | ||
| 982 | |||
| 976 | if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) { | 983 | if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) { |
| 977 | /* | 984 | /* |
| 978 | * We currently assume a one-to-one mapping between links | 985 | * We currently assume a one-to-one mapping between links |
