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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-11-18T09:09:18+01:00

xhttp_prom: safety checks for log messages

---

Modified: src/modules/xhttp_prom/xhttp_prom.c

---

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

---

diff --git a/src/modules/xhttp_prom/xhttp_prom.c 
b/src/modules/xhttp_prom/xhttp_prom.c
index 3a873ecdcdb..0cb16f9385a 100644
--- a/src/modules/xhttp_prom/xhttp_prom.c
+++ b/src/modules/xhttp_prom/xhttp_prom.c
@@ -1365,14 +1365,16 @@ static int ki_xhttp_prom_gauge_apply(struct sip_msg 
*msg, str *s_name,
 
        if(update_func(s_name, number, l1, l2, l3)) {
                LM_ERR("Cannot %s number: %f to gauge: %.*s (%.*s, %.*s, 
%.*s)\n",
-                               action_descr, number, s_name->len, s_name->s, 
l1->len, l1->s,
-                               l2->len, l2->s, l3->len, l3->s);
+                               action_descr, number, s_name->len, s_name->s,
+                               (l1) ? l1->len : 0, (l1) ? l1->s : "", (l2) ? 
l2->len : 0,
+                               (l2) ? l2->s : "", (l3) ? l3->len : 0, (l3) ? 
l3->s : "");
                return -1;
        }
 
        LM_DBG("Update gauge %.*s (%.*s, %.*s, %.*s): %s %f\n", s_name->len,
-                       s_name->s, l1->len, l1->s, l2->len, l2->s, l3->len, 
l3->s,
-                       action_descr, number);
+                       s_name->s, (l1) ? l1->len : 0, (l1) ? l1->s : "",
+                       (l2) ? l2->len : 0, (l2) ? l2->s : "", (l3) ? l3->len : 
0,
+                       (l3) ? l3->s : "", action_descr, number);
 
        return 1;
 }

_______________________________________________
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