]> git.ipfire.org Git - thirdparty/asterisk.git/commit
chan_sip: Do not allow non-SP/HTAB between header key and colon. 99/4599/1
authorWalter Doekes <walter+asterisk@wjd.nu>
Wed, 30 Nov 2016 15:31:39 +0000 (16:31 +0100)
committerKevin Harwell <kharwell@digium.com>
Thu, 8 Dec 2016 19:23:58 +0000 (13:23 -0600)
commit93dfe3964212deb8abbee7ab7f0153c64d660726
tree71ff532eeb7b07b5a3c7c5dee85fc34374340471
parent5a25b825276c8df42d7d10579957f26d3c777fbf
chan_sip: Do not allow non-SP/HTAB between header key and colon.

RFC says SIP headers look like:

    HCOLON  =  *( SP / HTAB ) ":" SWS
    SWS     =  [LWS]                    ; sep whitespace
    LWS     =  [*WSP CRLF] 1*WSP        ; linear whitespace
    WSP     =  SP / HTAB                ; from rfc2234

chan_sip implemented this:

    HCOLON  =  *( LOWCTL / SP ) ":" SWS
    LOWCTL  = %x00-1F                   ; CTL without DEL

This discrepancy meant that SIP proxies in front of Asterisk with
chan_sip could pass on unknown headers with \x00-\x1F in them, which
would be treated by Asterisk as a different (known) header.  For
example, the "To\x01:" header would gladly be forwarded by some proxies
as irrelevant, but chan_sip would treat it as the relevant "To:" header.

Those relying on a SIP proxy to scrub certain headers could mistakenly
get unexpected and unvalidated data fed to Asterisk.

This change fixes so chan_sip only considers SP/HTAB as valid tokens
before the colon, making it agree on the headers with other speakers of
SIP.

ASTERISK-26433 #close
AST-2016-009

Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b
(cherry picked from commit 26dd464dbd0ad7439bc29ce59ec55903d518ec6e)
channels/chan_sip.c