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;
        }


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3560/1713268171@github.com>