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

Author: herlesupreeth <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2025-12-13T20:43:22+01:00

ims_qos: use str2int rather than atoi

---

Modified: src/modules/ims_qos/rx_avp.c

---

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

---

diff --git a/src/modules/ims_qos/rx_avp.c b/src/modules/ims_qos/rx_avp.c
index 6270e7a9b3d..5f780929c1a 100644
--- a/src/modules/ims_qos/rx_avp.c
+++ b/src/modules/ims_qos/rx_avp.c
@@ -684,6 +684,7 @@ AAA_AVP *rx_create_media_subcomponent_avp(int number, str 
*proto, str *ipA,
        str data;
 
        int len, len2;
+       int intportA, intportB;
        int int_port_rctp_a = 0, int_port_rctp_b = 0;
        str port_rtcp_a = STR_NULL, port_rtcp_b = STR_NULL;
        AAA_AVP *flow_description1 = 0, *flow_description2 = 0,
@@ -721,8 +722,14 @@ AAA_AVP *rx_create_media_subcomponent_avp(int number, str 
*proto, str *ipA,
        }
        int proto_len = strlen(proto_nr);
 
-       int intportA = atoi(portA->s);
-       int intportB = atoi(portB->s);
+       if(str2int(portA, (unsigned int *)&intportA) != 0) {
+               LM_ERR("Invalid port A\n");
+               return NULL;
+       }
+       if(str2int(portB, (unsigned int *)&intportB) != 0) {
+               LM_ERR("Invalid port B\n");
+               return NULL;
+       }
 
        set_4bytes(x, number);
        flow_number = cdpb.AAACreateAVP(AVP_IMS_Flow_Number,

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to