Преглед изворни кода

nathelper: safety check for sipping_from when building SIP keepalive request

- reported by GH #1587
Daniel-Constantin Mierla пре 7 година
родитељ
комит
ade1cad69b
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      src/modules/nathelper/sip_pinger.h

+ 5 - 1
src/modules/nathelper/sip_pinger.h

@@ -127,6 +127,10 @@ static inline char *build_sipping(str *curi, struct socket_info *s, str *path,
 	str vaddr;
 	str vport;
 
+	if(sipping_from.s==NULL || sipping_from.len<=0) {
+		LM_WARN("SIP ping enabled but no SIP ping From address\n");
+		return NULL;
+	}
 	if(s->useinfo.name.len > 0)
 		vaddr = s->useinfo.name;
 	else
@@ -206,4 +210,4 @@ static inline char *build_sipping(str *curi, struct socket_info *s, str *path,
 	return buf;
 }
 
-#endif
+#endif