From 6d2bec7028d31a78c09fc5c83a9e4cff0f389036 Mon Sep 17 00:00:00 2001 From: Sean Bright <sean.bright@gmail.com> Date: Thu, 14 Jan 2021 09:47:21 -0500 Subject: [PATCH] res_pjsip_pubsub: Fix truncation of persisted SUBSCRIBE packet The last argument to ast_copy_string() is the buffer size, not the number of characters, so we add 1 to avoid stamping out the final \n in the persisted SUBSCRIBE message. Change-Id: I019b78942836f57965299af15d173911fcead5b2 --- res/res_pjsip_pubsub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index cf8baea6c8..dd088710fe 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -722,7 +722,7 @@ static void subscription_persistence_update(struct sip_subscription_tree *sub_tr || type == SUBSCRIPTION_PERSISTENCE_RECREATED) { if (rdata->msg_info.msg_buf) { ast_copy_string(sub_tree->persistence->packet, rdata->msg_info.msg_buf, - MIN(sizeof(sub_tree->persistence->packet), rdata->msg_info.len)); + MIN(sizeof(sub_tree->persistence->packet), rdata->msg_info.len + 1)); } else { ast_copy_string(sub_tree->persistence->packet, rdata->pkt_info.packet, sizeof(sub_tree->persistence->packet)); -- GitLab