Harald Welte has submitted this change and it was merged.

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


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

Change-Id: I42d41ec1370b9cc15d372b649d8e1bc78e76af9b
---
M lib/in46_addr.c
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/lib/in46_addr.c b/lib/in46_addr.c
index 6864c64..4b5fd64 100644
--- a/lib/in46_addr.c
+++ b/lib/in46_addr.c
@@ -62,7 +62,14 @@
 /*! 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;
 

-- 
To view, visit https://gerrit.osmocom.org/3840
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I42d41ec1370b9cc15d372b649d8e1bc78e76af9b
Gerrit-PatchSet: 3
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to