[Asterisk-code-review] res_pjsip_pubsub: Fix truncation of persisted SUBSCRIBE packet (asterisk[master])

Sean Bright asteriskteam at digium.com
Thu Jan 14 09:00:05 CST 2021


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15352 )


Change subject: res_pjsip_pubsub: Fix truncation of persisted SUBSCRIBE packet
......................................................................

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
---
M res/res_pjsip_pubsub.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/52/15352/1

diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index cf8baea..dd08871 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -722,7 +722,7 @@
 			|| 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));

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15352
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I019b78942836f57965299af15d173911fcead5b2
Gerrit-Change-Number: 15352
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210114/d05f30de/attachment-0001.html>


More information about the asterisk-code-review mailing list