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
This commit is contained in:
Sean Bright 2021-01-14 09:47:21 -05:00 committed by Joshua Colp
parent 9c56870929
commit fb42b60326
1 changed files with 1 additions and 1 deletions

View File

@ -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));