Commit f3e2738e authored by bbcallen's avatar bbcallen Committed by Jean-Baptiste Kempf

hls: m3u8 parser should pass 0xD at line end

Signed-off-by: default avatarHugo Beauzée-Luyssen <beauze.h@gmail.com>
(cherry picked from commit 8a57032172f9e6c737036cac6fe8f2e530ac21f1)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 98d157ad
...@@ -1808,22 +1808,28 @@ static char *ReadLine(uint8_t *buffer, uint8_t **pos, const size_t len) ...@@ -1808,22 +1808,28 @@ static char *ReadLine(uint8_t *buffer, uint8_t **pos, const size_t len)
while (p < end) while (p < end)
{ {
if ((*p == '\n') || (*p == '\0')) if ((*p == '\r') || (*p == '\n') || (*p == '\0'))
break; break;
p++; p++;
} }
/* copy line excluding \n or \0 */ /* copy line excluding \r \n or \0 */
line = strndup((char *)begin, p - begin); line = strndup((char *)begin, p - begin);
while ((*p == '\r') || (*p == '\n') || (*p == '\0'))
{
if (*p == '\0') if (*p == '\0')
{
*pos = end; *pos = end;
break;
}
else else
{ {
/* next pass start after \n */ /* next pass start after \r and \n */
p++; p++;
*pos = p; *pos = p;
} }
}
return line; return line;
} }
......
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