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

Author: Tim Anderson <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2025-09-23T17:59:36+02:00

xhttp_rpc: add handling of null strings in `print_value`

- reported by GH #4351

---

Modified: src/modules/xhttp_rpc/xhttp_rpc.c

---

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

---

diff --git a/src/modules/xhttp_rpc/xhttp_rpc.c 
b/src/modules/xhttp_rpc/xhttp_rpc.c
index b9c62763168..37f768195aa 100644
--- a/src/modules/xhttp_rpc/xhttp_rpc.c
+++ b/src/modules/xhttp_rpc/xhttp_rpc.c
@@ -322,7 +322,11 @@ static int print_value(rpc_ctx_t *ctx, char fmt, va_list 
*ap, str *id)
                        break;
                case 'S':
                        sp = va_arg(*ap, str *);
-                       body = *sp;
+                       if(sp) {
+                               body = *sp;
+                       } else {
+                               body = (str)str_init("&lt;null&gt;");
+                       }
                        break;
                default:
                        body.len = 0;

_______________________________________________
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