Commit c932b5e7 authored by Arjun Sreedharan's avatar Arjun Sreedharan Committed by Rémi Denis-Courmont

rtsp: avoid hardcoding buffer size

also maintain uniform case "CSeq" throughout.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 0fbeeb3e
......@@ -187,9 +187,9 @@ static int rtsp_send_request( rtsp_client_t *rtsp, const char *psz_type,
static void rtsp_schedule_standard( rtsp_client_t *rtsp )
{
char tmp[17];
char tmp[sizeof("CSeq: ") + 3 * sizeof(int)];
sprintf( tmp, "Cseq: %u", rtsp->p_private->cseq);
sprintf( tmp, "CSeq: %u", rtsp->p_private->cseq);
rtsp_schedule_field( rtsp, tmp );
if( rtsp->p_private->session )
......@@ -226,7 +226,7 @@ static int rtsp_get_answers( rtsp_client_t *rtsp )
answer = rtsp_get( rtsp );
if( !answer ) return 0;
if( !strncasecmp( answer, "Cseq:", 5 ) )
if( !strncasecmp( answer, "CSeq:", 5 ) )
{
sscanf( answer, "%*s %u", &answer_seq );
if( rtsp->p_private->cseq != answer_seq )
......@@ -284,7 +284,7 @@ static int rtsp_get_answers( rtsp_client_t *rtsp )
int rtsp_send_ok( rtsp_client_t *rtsp )
{
char cseq[17];
char cseq[sizeof("CSeq: ") + 3 * sizeof(int)];
rtsp_put( rtsp, "RTSP/1.0 200 OK" );
sprintf( cseq, "CSeq: %u", rtsp->p_private->cseq );
......@@ -418,7 +418,7 @@ int rtsp_read_data( rtsp_client_t *rtsp, uint8_t *buffer, unsigned int size )
rest = rtsp_get( rtsp );
if( !rest ) return -1;
if( !strncasecmp( rest, "Cseq:", 5 ) )
if( !strncasecmp( rest, "CSeq:", 5 ) )
sscanf( rest, "%*s %u", &seq );
} while( *rest );
free( rest );
......@@ -431,7 +431,7 @@ int rtsp_read_data( rtsp_client_t *rtsp, uint8_t *buffer, unsigned int size )
/* lets make the server happy */
rtsp_put( rtsp, "RTSP/1.0 451 Parameter Not Understood" );
rest = xmalloc(17);
rest = xmalloc(sizeof("Cseq: ") + 3 * sizeof(int));
sprintf( rest,"CSeq: %u", seq );
rtsp_put( rtsp, rest );
rtsp_put( rtsp, "" );
......
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