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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-05-26T18:58:59+02:00

carrierroute: check pointer and length for str value

---

Modified: src/modules/carrierroute/cr_rpc_helper.c

---

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

---

diff --git a/src/modules/carrierroute/cr_rpc_helper.c 
b/src/modules/carrierroute/cr_rpc_helper.c
index fa1537151df..5077875bce5 100644
--- a/src/modules/carrierroute/cr_rpc_helper.c
+++ b/src/modules/carrierroute/cr_rpc_helper.c
@@ -107,7 +107,7 @@ static int update_route_data_recursor(
                                                if(rr->host.s) {
                                                        shm_free(rr->host.s);
                                                }
-                                               if(opts->new_host.len) {
+                                               if(opts->new_host.s && 
opts->new_host.len) {
                                                        if((rr->host.s = 
shm_malloc(opts->new_host.len + 1))
                                                                        == 
NULL) {
                                                                SHM_MEM_ERROR;
@@ -132,12 +132,10 @@ static int update_route_data_recursor(
                                                        FIFO_ERR(E_RESET);
                                                        return -1;
                                                }
-                                               if(opts->new_host.len > 0) {
+                                               if(opts->new_host.s && 
opts->new_host.len > 0) {
                                                        LM_INFO("deactivating 
host %.*s\n", rr->host.len,
                                                                        
rr->host.s);
-                                                       if(opts->new_host.s
-                                                                       && 
(strcmp(opts->new_host.s, rr->host.s)
-                                                                               
        == 0)) {
+                                                       
if(strcmp(opts->new_host.s, rr->host.s) == 0) {
                                                                LM_ERR("Backup 
host the same as initial host "
                                                                           
"%.*s",
                                                                                
rr->host.len, rr->host.s);

_______________________________________________
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