9
0
Fork 0

lib/in46_addr: Avoid ASSERT() when in46a_ntop() is called on uninitialized address

Change-Id: I42d41ec1370b9cc15d372b649d8e1bc78e76af9b
This commit is contained in:
Harald Welte 2017-08-12 14:54:28 +02:00
parent 7fc8694b97
commit 33520b43ec
1 changed files with 8 additions and 1 deletions

View File

@ -62,7 +62,14 @@ int in46a_to_sas(struct sockaddr_storage *out, const struct in46_addr *in)
/*! Convenience wrapper around inet_ntop() for \ref in46_addr */
const char *in46a_ntop(const struct in46_addr *in, char *dst, socklen_t dst_size)
{
int af = in46a_to_af(in);
int af;
if (!in || in->len == 0) {
strncpy(dst, "UNDEFINED", dst_size);
return dst;
}
af = in46a_to_af(in);
if (af < 0)
return NULL;