mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-03-13 14:58:07 +08:00
human_addr2(): only attempt to parse INET addresses
This commit is contained in:
@@ -40,6 +40,10 @@ char *human_addr2(const struct sockaddr *sa, socklen_t salen,
|
|||||||
if (!buf || !buflen)
|
if (!buf || !buflen)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (sa->sa_family != AF_INET && sa->sa_family != AF_INET6) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (full != 0 && salen == sizeof(struct sockaddr_in6) &&
|
if (full != 0 && salen == sizeof(struct sockaddr_in6) &&
|
||||||
((struct sockaddr_in6*)sa)->sin6_port != 0) {
|
((struct sockaddr_in6*)sa)->sin6_port != 0) {
|
||||||
*buf = '[';
|
*buf = '[';
|
||||||
|
|||||||
Reference in New Issue
Block a user