Commit 94df4c46 authored by Filip Roséen's avatar Filip Roséen Committed by Jean-Baptiste Kempf

realrtsp: fixed `rtsp_search_answers` (bounds + error-checking)

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7c5f750b
......@@ -583,22 +583,30 @@ void rtsp_close( rtsp_client_t *rtsp )
char *rtsp_search_answers( rtsp_client_t *rtsp, const char *tag )
{
char **answer;
char **answers;
char *ptr;
int i;
if( !rtsp->p_private->answers ) return NULL;
answer = rtsp->p_private->answers;
if(rtsp->p_private->answers == NULL || tag == NULL)
return NULL;
while(*answer)
{
if( !strncasecmp( *answer, tag, strlen(tag) ) )
{
ptr = strchr(*answer, ':');
ptr++;
while( *ptr == ' ' ) ptr++;
return ptr;
}
answer++;
answers = rtsp->p_private->answers;
for (i = 0; i < MAX_FIELDS; ++i) {
if (answers[i] == NULL)
break;
if (!strncasecmp(answers[i], tag, strlen(tag))){
ptr = strchr(answers[i], ':');
if (ptr == NULL)
return answers[i] + strlen(answers[i]); /* no payload => empty string */
for (++ptr; *ptr == ' '; ++ptr)
;
return ptr;
}
}
return NULL;
......
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