Hello,
Could you please help check below error?
I would like to add a script counter to count the number of received message by kamailio.
Anything wrong to use counters module?
Thank you in advance.
Kamailio.cfg change
[cid:image001.png@01D4E3C2.32E8DFB0]
Kamailo log
[cid:image002.png@01D4E3C2.8237E9D0]
### Description
Providing Kamailio with a domain name longer than 72 chars causes Kamailio to crash with an error in `fix_sock_str`. Looking at the code it appears that the `fix_sock_str` function only assumes it is being passed IP addresses so the buffer length is configured for the length of an IPv6 address represented as a string.
It appears to include the portion of the string representing the port as can be seen in the two example config lines below.
#### Reproduction
The problem can be reproduced by adding the following line to the `kamailio.cfg` and running `kamailio` with the `-c` config check option.
```
listen=tcp:eth0:5060 advertise "example.example.example.example.example.example.example.example.exa":50
listen=tcp:eth0:5061 advertise "example.example.example.example.example.example.example.example.e":5060
```
#### Debugging Data
N/A
#### Log Messages
```
0(100) ERROR: <core> [core/socket_info.c:376]: socketinfo2str(): Destionation buffer too short
0(100) BUG: <core> [core/socket_info.c:443]: fix_sock_str(): fix_sock_str: Error in socket to str
0(100) ERROR: <core> [core/socket_info.c:1841]: fix_all_socket_lists(): fix_socket_list tcp failed
failed to initialize list addresses
```
#### SIP Traffic
N/A
### Possible Solutions
Don't use listen addresses longer than 70 chars.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.2.2 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, 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_BLACKLIST, HAVE_RESOLV_RES
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: unknown
compiled with gcc 6.3.0
```
* **Operating System**:
Debian container running on Arch Linux host.
```
Debian GNU/Linux 9 (stretch)
Linux 75dbf08c8303 5.0.3-arch1-1-ARCH #1 SMP PREEMPT Tue Mar 19 13:09:13 UTC 2019 x86_64 GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1901
Module: kamailio
Branch: master
Commit: 65e7a23d701ab195035f8b8d8ef01ac6cc03670b
URL: https://github.com/kamailio/kamailio/commit/65e7a23d701ab195035f8b8d8ef01ac…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-03-24T19:20:55+01:00
tm: small spelling fix: lenght -> length
---
Modified: src/modules/tm/t_msgbuilder.c
---
Diff: https://github.com/kamailio/kamailio/commit/65e7a23d701ab195035f8b8d8ef01ac…
Patch: https://github.com/kamailio/kamailio/commit/65e7a23d701ab195035f8b8d8ef01ac…
---
diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index aad14aa78f..a1c471a504 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -1104,7 +1104,7 @@ char *build_dlg_ack(struct sip_msg* rpl, struct cell *Trans,
* into the same allocated chunk of memory (retr. buffer first, string
* buffer follows).In this case, the 'len' param is used as in-out
* parameter: 'in' to give the extra space needed by the retr. buffer,
- * 'out' to return the lenght of the allocated string buffer.
+ * 'out' to return the length of the allocated string buffer.
*/
unsigned offset = *len;
#endif
Module: kamailio
Branch: master
Commit: e59fa0c52af3ea5ddea435ec0b48df737f6aa5aa
URL: https://github.com/kamailio/kamailio/commit/e59fa0c52af3ea5ddea435ec0b48df7…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-03-24T19:20:21+01:00
ndb_redis: small spelling fix: lenght -> length
---
Modified: src/modules/ndb_redis/redis_client.c
---
Diff: https://github.com/kamailio/kamailio/commit/e59fa0c52af3ea5ddea435ec0b48df7…
Patch: https://github.com/kamailio/kamailio/commit/e59fa0c52af3ea5ddea435ec0b48df7…
---
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index 7e3ddb0d8c..a4531801b4 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -1019,12 +1019,12 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
/**
* Executes a redis command.
- * Command is coded using a vector of strings, and a vector of lenghts.
+ * Command is coded using a vector of strings, and a vector of lengths.
*
* @param rsrv Pointer to a redis_server_t structure.
* @param argc number of elements in the command vector.
* @param argv vector of zero terminated strings forming the command.
- * @param argvlen vector of command string lenghts or NULL.
+ * @param argvlen vector of command string lengths or NULL.
* @return redisReply structure or NULL if there was an error.
*/
redisReply* redisc_exec_argv(redisc_server_t *rsrv, int argc, const char **argv,