vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Thu Apr 25 
18:04:07 2013 +0300| [5e7e45dead26528d648a645b907df877100ecc31] | committer: 
Rémi Denis-Courmont

stream_ReadLine: correctly return an error on overflow (fixes #7361)

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

 src/input/stream.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 4718f70..d3c4d9e 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1472,7 +1472,7 @@ char *stream_ReadLine( stream_t *s )
     char *p_line = NULL;
     int i_line = 0, i_read = 0;
 
-    while( i_read < STREAM_LINE_MAX )
+    for( ;; )
     {
         char *psz_eol;
         const uint8_t *p_data;
@@ -1585,6 +1585,9 @@ char *stream_ReadLine( stream_t *s )
         if( i_data <= 0 ) break; /* Hmmm */
         i_line += i_data;
         i_read += i_data;
+
+        if( i_read >= STREAM_LINE_MAX )
+            goto error; /* line too long */
     }
 
     if( i_read > 0 )

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to