Module: kamailio
Branch: 5.1
Commit: 538ac2c5eeb9f2df1d896adf0661e5e35fadb504
URL:
https://github.com/kamailio/kamailio/commit/538ac2c5eeb9f2df1d896adf0661e5e…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2018-06-08T21:20:54+02:00
core: make dns name to IP conversion more robust for IPv4 and IPv6
(cherry picked from commit 4a55a2b40b91f282d7fd8f0e3c3ae22bcf56d9dc)
---
Modified: src/core/resolve.h
---
Diff:
https://github.com/kamailio/kamailio/commit/538ac2c5eeb9f2df1d896adf0661e5e…
Patch:
https://github.com/kamailio/kamailio/commit/538ac2c5eeb9f2df1d896adf0661e5e…
---
diff --git a/src/core/resolve.h b/src/core/resolve.h
index fad783e4e6..30cce19581 100644
--- a/src/core/resolve.h
+++ b/src/core/resolve.h
@@ -229,6 +229,10 @@ static inline struct ip_addr* str2ip(str* st)
static struct ip_addr ip;
unsigned char* s;
+ /* just in case that e.g. the VIA parser get confused */
+ if(unlikely(!st->s || st->len <= 0)) {
+ LM_ERR("invalid name, no conversion to IP address possible\n");
+ }
s=(unsigned char*)st->s;
/*init*/
@@ -281,6 +285,10 @@ static inline struct ip_addr* str2ip6(str* st)
unsigned char* limit;
unsigned char* s;
+ /* just in case that e.g. the VIA parser get confused */
+ if(unlikely(!st->s || st->len <= 0)) {
+ LM_ERR("invalid name, no conversion to IP address possible\n");
+ }
/* init */
if ((st->len) && (st->s[0]=='[')){
/* skip over [ ] */