[Asterisk-code-review] chan sip: Fix SUBSCRIBE with missing "Expires" header. (asterisk[15])

Jenkins2 asteriskteam at digium.com
Wed Oct 25 07:59:23 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6901 )

Change subject: chan_sip: Fix SUBSCRIBE with missing "Expires" header.
......................................................................

chan_sip: Fix SUBSCRIBE with missing "Expires" header.

When chan_sip receives a SUBSCRIBE request with no "Expires" header it
processes the request as an unsubscribe.  This is incorrect, per RFC3264
when the "Expires" header is missing a default expiry should be used.

ASTERISK-18140

Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
---
M channels/chan_sip.c
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8833e71..cdd78fd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -28511,7 +28511,13 @@
 		p->lastinvite = seqno;
 	}
 	if (!p->needdestroy) {
-		p->expiry = atoi(sip_get_header(req, "Expires"));
+		const char *expires_str = sip_get_header(req, "Expires");
+
+		if (ast_strlen_zero(expires_str)) {
+			p->expiry = default_expiry;
+		} else {
+			p->expiry = atoi(expires_str);
+		}
 
 		/* check if the requested expiry-time is within the approved limits from sip.conf */
 		if (p->expiry > max_subexpiry) {

-- 
To view, visit https://gerrit.asterisk.org/6901
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
Gerrit-Change-Number: 6901
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171025/441697e1/attachment.html>


More information about the asterisk-code-review mailing list