<!-- Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio....
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.or...
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment). -->
### Description
<!-- Explain what you did, what you expected to happen, and what actually happened. -->
### Troubleshooting
#### Reproduction
<!-- If the issue can be reproduced, describe how it can be done. -->
#### Debugging Data
<!-- If you got a core dump, use gdb to extract troubleshooting data - full backtrace, local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile bt full info locals list
If you are familiar with gdb, feel free to attach more of what you consider to be relevant. -->
``` (paste your debugging data here) ```
#### Log Messages
<!-- Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` in $mb from xlog shows path header as Path: <sip:xx.xxx.xx.xx suffix header part is not getting appended creating malformed packet
```
#### SIP Traffic
<!-- REGISTER sip:xx.xxxx.xx.xxxx.xx SIP/2.0 From: "+914962207321"<sip:+91111111111@xx.xxxx.xx.xxxx.xx>;tag=786f78-a7504e5-13c4-590628-2b088c7a-590628 To: "+914962207321"<sip:+911111111111@xx.xxxx.xx.xxxx.xx> P-Access-Network-Info: ADSL;ue-ip=10.117.x.xxx;ue-port=5060;transport=udp;nat=no Call-ID: 790930-a7504e5-13c4-590628-aede83e-590628 CSeq: 2 REGISTER Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK1af.96eb50fa0163b0488a72566a78846e9f.0 Via: SIP/2.0/UDP 10.117.x.xxx:5060;rport=5060;branch=z9hG4bK-590628-5bc00f10-3253a7b8 Max-Forwards: 69 Supported: 100rel,replaces,timer Contact: <sip:+911111111111@10.117.x.xxx:5060> Expires: 3600 Authorization: Digest username="+911111111111",realm="xx.xxxx.xx.xxxx.xx",nonce="eqvZt86/W0Pt/0bN+SZKLw==",uri="sip:xx.xxxx.xx.xxxx.xx",response="3213963a37bd59cf4b16a5d4080da415",algorithm=MD5,cnonce="5bc00f1a",qop=auth,nc=00000001 Content-Length: 0 Path: <sip:127.0.1.1 -->
``` (paste your sip traffic here) ```
### Possible Solutions
<!-- reverted to pre "use snprintf() instead of sprintf()" merge for patch.c it works fine -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.8.0-dev1 (x86_64/linux) 99eb1b flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, 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: 99eb1b compiled on 10:38:25 Sep 8 2023 with gcc 11.4.0
```
* **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`) -->
``` Ubuntu 22.04 ```
can you please test this fix?
``` commit 2c8e38c8cef52ea406d06c9e1508ff45c6147cbe (HEAD -> master) Author: Victor Seva linuxmaniac@torreviejawireless.org Date: Mon Sep 11 08:46:02 2023 +0200
path: fix prepend_path()
bug introduced at dd04bceb99ba69bd59c67ba103f3c55d47a31dd6
diff --git a/src/modules/path/path.c b/src/modules/path/path.c index 2431a98555..8fde991260 100644 --- a/src/modules/path/path.c +++ b/src/modules/path/path.c @@ -183,7 +183,7 @@ static int prepend_path( prefix_len = snprintf( prefix, prefix_len, PATH_PREFIX "%.*s@", user->len, user->s); else - prefix_len = sprintf(prefix, PATH_PREFIX); + prefix_len = snprintf(prefix, prefix_len, PATH_PREFIX);
if(parse_headers(_m, HDR_PATH_F, 0) < 0) { LM_ERR("failed to parse message for Path header\n"); @@ -208,7 +208,7 @@ static int prepend_path( l, (path_sockname_mode) ? SUBST_SND_ALL_EX : SUBST_SND_ALL, 0); if(!l) goto out2; - l = insert_new_lump_before(l, suffix, cp.s - suffix, 0); + l = insert_new_lump_before(l, suffix, cp.len, 0); if(!l) goto out2;
@@ -223,10 +223,10 @@ static int prepend_path( l, (path_sockname_mode) ? SUBST_RCV_ALL_EX : SUBST_RCV_ALL, 0); if(!l) goto out1; - dp = path_strzdup(suffix, cp.s - suffix); + dp = path_strzdup(suffix, cp.len); if(dp == NULL) goto out1; - l = insert_new_lump_before(l, dp, cp.s - suffix, 0); + l = insert_new_lump_before(l, dp, cp.len, 0); if(!l) goto out1; } ```
yes after the fix it is working fine. Thankyou
fixed by d0d6436cfc
Closed #3560 as completed.