[vlc-commits] hls: m3u8 parser should pass 0xD at line end

bbcallen git at videolan.org
Fri Mar 9 15:32:36 CET 2012


vlc | branch: master | bbcallen <bbcallen at gmail.com> | Fri Mar  9 17:36:31 2012 +0800| [8a57032172f9e6c737036cac6fe8f2e530ac21f1] | committer: Hugo Beauzée-Luyssen

hls: m3u8 parser should pass 0xD at line end

Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a57032172f9e6c737036cac6fe8f2e530ac21f1
---

 modules/stream_filter/httplive.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index ffebc0f..f13c568 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1808,21 +1808,27 @@ static char *ReadLine(uint8_t *buffer, uint8_t **pos, const size_t len)
 
     while (p < end)
     {
-        if ((*p == '\n') || (*p == '\0'))
+        if ((*p == '\r') || (*p == '\n') || (*p == '\0'))
             break;
         p++;
     }
 
-    /* copy line excluding \n or \0 */
+    /* copy line excluding \r \n or \0 */
     line = strndup((char *)begin, p - begin);
 
-    if (*p == '\0')
-        *pos = end;
-    else
+    while ((*p == '\r') || (*p == '\n') || (*p == '\0'))
     {
-        /* next pass start after \n */
-        p++;
-        *pos = p;
+        if (*p == '\0')
+        {
+            *pos = end;
+            break;
+        }
+        else
+        {
+            /* next pass start after \r and \n */
+            p++;
+            *pos = p;
+        }   
     }
 
     return line;



More information about the vlc-commits mailing list