Skip to content

Commit e5864d1

Browse files
committed
Make is_numhost() more broad for the IPv6 addresses.
1 parent e7f5ae9 commit e5864d1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/rtpp_network.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,17 @@ int
375375
is_numhost(const char *hostnm, int pf)
376376
{
377377

378-
if ((pf == AF_INET6) && (strcmp(hostnm, "::1") == 0))
379-
return 1;
380-
if ((pf == AF_INET) && (strcmp(hostnm, "127.0.0.1") == 0))
381-
return 1;
382-
return 0;
378+
if (pf == AF_INET) {
379+
if (strcmp(hostnm, "127.0.0.1") == 0)
380+
return 1;
381+
return 0;
382+
}
383+
RTPP_DBG_ASSERT(pf == AF_INET6);
384+
if (strchr(hostnm, '.') != NULL)
385+
return 0;
386+
if (strspn(hostnm, "0123456789abcdefABCDEF:") != strlen(hostnm))
387+
return 0;
388+
return 1;
383389
}
384390

385391
int

0 commit comments

Comments
 (0)