Browse code

nat_traversal: check parameter for send_keepalive()

(cherry picked from commit f33abd5e2d5978ba9e6e8a48066b0daff70c0b3b)

Daniel-Constantin Mierla authored on 08/04/2021 10:05:07
Showing 1 changed files
... ...
@@ -1554,6 +1554,11 @@ static void send_keepalive(NAT_Contact *contact)
1554 1554
 	unsigned short lport;
1555 1555
 	char lproto;
1556 1556
 
1557
+	if(contact==NULL || contact->socket==NULL) {
1558
+		LM_ERR("invalid parameters\n");
1559
+		return;
1560
+	}
1561
+
1557 1562
 	if(keepalive_params.from == NULL) {
1558 1563
 		if(contact->socket != last_socket) {
1559 1564
 			memcpy(from_ip, contact->socket->address_str.s,