Browse code

nat_traversal: check parameter for send_keepalive()

(cherry picked from commit f33abd5e2d5978ba9e6e8a48066b0daff70c0b3b)
(cherry picked from commit e0948071566a8d978dc2c57a21a7448b953a11e1)

Daniel-Constantin Mierla authored on 08/04/2021 10:05:07 • Henning Westerholt committed on 22/10/2021 11:50:03
Showing 1 changed files
... ...
@@ -1596,6 +1596,11 @@ static void send_keepalive(NAT_Contact *contact)
1596 1596
 	unsigned short lport;
1597 1597
 	char lproto;
1598 1598
 
1599
+	if(contact==NULL || contact->socket==NULL) {
1600
+		LM_ERR("invalid parameters\n");
1601
+		return;
1602
+	}
1603
+
1599 1604
 	if(keepalive_params.from == NULL) {
1600 1605
 		if(contact->socket != last_socket) {
1601 1606
 			memcpy(from_ip, contact->socket->address_str.s,