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

Corey Farrell asteriskteam at digium.com
Tue Oct 24 11:03:03 CDT 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/6900


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/00/6900/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ef83666..fd780b6 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -28672,7 +28672,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/6900
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
Gerrit-Change-Number: 6900
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171024/1f1cda0a/attachment.html>


More information about the asterisk-code-review mailing list