Commit 986116e2 authored by Clément Stenac's avatar Clément Stenac

Fix for bad SAP packets with no \0 between headers and payload

parent 1b24f8ca
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sap.c : SAP interface module * sap.c : SAP interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.22 2003/09/11 15:34:16 zorglub Exp $ * $Id: sap.c,v 1.23 2003/09/15 08:33:29 zorglub Exp $
* *
* Authors: Arnaud Schauly <gitan@via.ecp.fr> * Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr> * Clment Stenac <zorglub@via.ecp.fr>
...@@ -590,6 +590,14 @@ static int parse_sap( char *p_packet ) ...@@ -590,6 +590,14 @@ static int parse_sap( char *p_packet )
//Looks for the first '\0' byte after length //Looks for the first '\0' byte after length
for(;p_packet[i_hlen]!='\0'; i_hlen++); for(;p_packet[i_hlen]!='\0'; i_hlen++);
if( i_hlen > 50 ) /* Definitely too long...
Maybe we have a fucked up packet without \0 */
{ /* As a workaround, we search for "v=" */
i_hlen = 4;
for(;p_packet[i_hlen] != 'v' && p_packet[i_hlen+1] != '=' ; i_hlen++);
return i_hlen-1;
}
return(i_hlen); return(i_hlen);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment