Browse Source

ims_ipsec_pcscf: safety check for pcontact search result

Daniel-Constantin Mierla 3 năm trước cách đây
mục cha
commit
b1eb0928f8
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      src/modules/ims_ipsec_pcscf/cmd.c

+ 4 - 3
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;
     }