lkml.org 
[lkml]   [2011]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[052/165] netfilter: nf_ct_sip: fix SDP parsing in TCP SIP messages for some Cisco phones
    2.6.39-stable review patch.  If anyone has any objections, please let us know.

    ------------------
    Content-Length: 1530
    Lines: 49


    From: Patrick McHardy <kaber@trash.net>

    [ Upstream commit e6e4d9ed11fb1fab8b3256a3dc14d71b5e984ac4 ]

    Some Cisco phones do not place the Content-Length field at the end of the
    SIP message. This is valid, due to a misunderstanding of the specification
    the parser expects the SDP body to start directly after the Content-Length
    field. Fix the parser to scan for \r\n\r\n to locate the beginning of the
    SDP body.

    Reported-by: Teresa Kang <teresa_kang@gemtek.com.tw>
    Signed-off-by: Patrick McHardy <kaber@trash.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    net/netfilter/nf_conntrack_sip.c | 14 ++++++++++----
    1 file changed, 10 insertions(+), 4 deletions(-)

    --- a/net/netfilter/nf_conntrack_sip.c
    +++ b/net/netfilter/nf_conntrack_sip.c
    @@ -1419,6 +1419,7 @@ static int sip_help_tcp(struct sk_buff *
    const char *dptr, *end;
    s16 diff, tdiff = 0;
    int ret = NF_ACCEPT;
    + bool term;
    typeof(nf_nat_sip_seq_adjust_hook) nf_nat_sip_seq_adjust;

    if (ctinfo != IP_CT_ESTABLISHED &&
    @@ -1453,10 +1454,15 @@ static int sip_help_tcp(struct sk_buff *
    if (dptr + matchoff == end)
    break;

    - if (end + strlen("\r\n\r\n") > dptr + datalen)
    - break;
    - if (end[0] != '\r' || end[1] != '\n' ||
    - end[2] != '\r' || end[3] != '\n')
    + term = false;
    + for (; end + strlen("\r\n\r\n") <= dptr + datalen; end++) {
    + if (end[0] == '\r' && end[1] == '\n' &&
    + end[2] == '\r' && end[3] == '\n') {
    + term = true;
    + break;
    + }
    + }
    + if (!term)
    break;
    end += strlen("\r\n\r\n") + clen;




    \
     
     \ /
      Last update: 2011-06-01 10:53    [W:4.635 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site