[sr-dev] git:master:b1eb0928: ims_ipsec_pcscf: safety check for pcontact search result

Daniel-Constantin Mierla miconda at gmail.com
Wed May 4 10:03:06 CEST 2022


Module: kamailio
Branch: master
Commit: b1eb0928f8e68a697eccda3e75504eb2263cb95b
URL: https://github.com/kamailio/kamailio/commit/b1eb0928f8e68a697eccda3e75504eb2263cb95b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-05-04T10:02:18+02:00

ims_ipsec_pcscf: safety check for pcontact search result

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b1eb0928f8e68a697eccda3e75504eb2263cb95b.diff
Patch: https://github.com/kamailio/kamailio/commit/b1eb0928f8e68a697eccda3e75504eb2263cb95b.patch

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c b/src/modules/ims_ipsec_pcscf/cmd.c
index 5013087c02..0651d4226f 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -667,7 +667,7 @@ int ipsec_create(struct sip_msg* m, udomain_t* d, int _cflags)
 
     ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);
 
-    if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0) {
+    if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0 || pcontact==NULL) {
         LM_ERR("Contact doesn't exist\n");
         goto cleanup;
     }
@@ -810,7 +810,8 @@ int ipsec_forward(struct sip_msg* m, udomain_t* d, int _cflags)
 
     ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);
 
-    if (ul.get_pcontact(d, &ci, &pcontact, _cflags & IPSEC_REVERSE_SEARCH) != 0) {
+    if (ul.get_pcontact(d, &ci, &pcontact, _cflags & IPSEC_REVERSE_SEARCH) != 0
+    		|| pcontact==NULL) {
         LM_ERR("Contact doesn't exist\n");
         goto cleanup;
     }
@@ -967,7 +968,7 @@ int ipsec_destroy(struct sip_msg* m, udomain_t* d)
 
     ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);
 
-    if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0) {
+    if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0 || pcontact==NULL) {
         LM_ERR("Contact doesn't exist\n");
         goto cleanup;
     }




More information about the sr-dev mailing list