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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-28T10:56:12+01:00

ims_registrar_pcscf: init and check vb variable

---

Modified: src/modules/ims_registrar_pcscf/service_routes.c

---

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

---

diff --git a/src/modules/ims_registrar_pcscf/service_routes.c 
b/src/modules/ims_registrar_pcscf/service_routes.c
index 26b31ad6f1e..c04db041e0c 100644
--- a/src/modules/ims_registrar_pcscf/service_routes.c
+++ b/src/modules/ims_registrar_pcscf/service_routes.c
@@ -228,7 +228,7 @@ pcontact_t *getContactP(struct sip_msg *_m, udomain_t *_d,
        pcontact_info_t search_ci;
        str received_host = {0, 0};
        char srcip[50];
-       struct via_body *vb;
+       struct via_body *vb = NULL;
        unsigned short port, proto;
        str host;
        sip_uri_t contact_uri;
@@ -274,7 +274,7 @@ pcontact_t *getContactP(struct sip_msg *_m, udomain_t *_d,
                   "[%d://%.*s:%d]\n",
                        proto, host.len, host.s, port);
 
-       if(trust_bottom_via) {
+       if(trust_bottom_via && vb) {
                if(vb->received != NULL && vb->received->value.len > 0) {
                        received_host = vb->received->value;
                } else {
@@ -285,7 +285,7 @@ pcontact_t *getContactP(struct sip_msg *_m, udomain_t *_d,
                received_host.s = srcip;
        }
        unsigned short received_port = 0;
-       if(trust_bottom_via) {
+       if(trust_bottom_via && vb) {
                if(vb->rport != NULL && vb->rport->value.len > 0) {
                        received_port = atoi(vb->rport->value.s);
                } else {
@@ -298,7 +298,7 @@ pcontact_t *getContactP(struct sip_msg *_m, udomain_t *_d,
                received_port = 5060;
        }
        char received_proto = 0;
-       if(trust_bottom_via && vb->proto) {
+       if(trust_bottom_via && vb && vb->proto) {
                received_proto = vb->proto;
        } else {
                received_proto = _m->rcv.proto;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to