| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b968d89 commit 6076291
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -360,16 +360,20 @@ Local<Object> AddressToJS(Environment* env, | |||
| 360 | 360 | a6 = reinterpret_cast<const sockaddr_in6*>(addr); | |
| 361 | 361 | uv_inet_ntop(AF_INET6, &a6->sin6_addr, ip, sizeof ip); | |
| 362 | 362 | // Add an interface identifier to a link local address. | |
| 363 | - if (IN6_IS_ADDR_LINKLOCAL(&a6->sin6_addr)) { | ||
| 364 | - const size_t addrlen = strlen(ip); | ||
| 365 | - CHECK_LT(addrlen, sizeof(ip)); | ||
| 366 | - ip[addrlen] = '%'; | ||
| 367 | - size_t scopeidlen = sizeof(ip) - addrlen - 1; | ||
| 368 | - CHECK_GE(scopeidlen, UV_IF_NAMESIZE); | ||
| 369 | - const int r = uv_if_indextoiid(a6->sin6_scope_id, | ||
| 370 | - ip + addrlen + 1, | ||
| 371 | - &scopeidlen); | ||
| 372 | - CHECK_EQ(r, 0); | ||
| 363 | + if (IN6_IS_ADDR_LINKLOCAL(&a6->sin6_addr) && a6->sin6_scope_id > 0) { | ||
| 364 | + const size_t addrlen = strlen(ip); | ||
| 365 | + CHECK_LT(addrlen, sizeof(ip)); | ||
| 366 | + ip[addrlen] = '%'; | ||
| 367 | + size_t scopeidlen = sizeof(ip) - addrlen - 1; | ||
| 368 | + CHECK_GE(scopeidlen, UV_IF_NAMESIZE); | ||
| 369 | + const int r = uv_if_indextoiid(a6->sin6_scope_id, | ||
| 370 | + ip + addrlen + 1, | ||
| 371 | + &scopeidlen); | ||
| 372 | + if (r) { | ||
| 373 | + env->ThrowUVException(r, "uv_if_indextoiid"); | ||
| 374 | + // TODO(addaleax): Do proper MaybeLocal handling here | ||
| 375 | + return scope.Escape(info); | ||
| 376 | + } | ||
| 373 | 377 | } | |
| 374 | 378 | port = ntohs(a6->sin6_port); | |
| 375 | 379 | info->Set(env->context(), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments