timando created an issue (kamailio/kamailio#4351)
### Description
Getting the list of kemi APIs via xhttp_rpc causes a segfault and crashes
kamailio
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
#### Reproduction
Run kamailio with the following config file:
```
loadmodule "xhttp.so"
loadmodule "xhttp_rpc.so"
loadmodule "sl.so"
loadmodule "app_lua"
loadmodule "jsonrpcs"
modparam("jsonrpcs", "transport", 1)
tcp_accept_no_cl=yes
port=8060
pv_buffer_size=65536
pv_buffer_slots=64
request_route {
exit;
}
event_route[xhttp:request] {
set_reply_close();
if ($hu =~ "^/rpc") {
dispatch_xhttp_rpc();
exit;
}
jsonrpc_exec('{"jsonrpc": "2.0", "method": "app_lua.api_list", "id":
1}');
xhttp_reply("200", "OK", "text/html",
"<html><body><pre>$jsonrpl(body)</pre></body></html>");
exit;
}
```
`curl "http://localhost:8060/rpc/app_lua/api_list?arg="`
### Possible Solutions
I will create a pull request which fixes it by:
- Editing xhttp_rpc to handle nulls without crashing
- Editing kemi to not return null when describing long parameters
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.7.0-dev1 (x86_64/linux) 3406b9-dirty
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE,
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC,
DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES,
TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024,
BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 3406b9 -dirty
compiled on 10:50:37 Aug 7 2025 with gcc 14.2.1
```
Note: problem exists in latest git version
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `lsb_release -a` and `uname -a`)
-->
AlmaLinux 10 container running on AlmaLinux Kitten 10 host. Problem also occurs
using Debian 12 container
```
LSB Version: n/a
Distributor ID: AlmaLinux
Description: AlmaLinux Kitten 10 (Lion Cub)
Release: 10
Codename: n/a
Linux tim-laptop 6.12.0-109.el10.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 15
23:14:08 EDT 2025 x86_64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4351
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4...@github.com>
_______________________________________________
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!