[Asterisk-code-review] res_pjsip_pubsub: Fix truncation of persisted SUBSCRIBE packet (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Mon Jan 18 10:27:34 CST 2021
Joshua Colp has submitted this change. ( 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(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
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: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210118/fb2e4efe/attachment-0001.html>
More information about the asterisk-code-review
mailing list