Commit 62e9da14 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Felix Paul Kühne

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

(cherry picked from commit 5e7e45dead26528d648a645b907df877100ecc31)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 9defa225
...@@ -1472,7 +1472,7 @@ char *stream_ReadLine( stream_t *s ) ...@@ -1472,7 +1472,7 @@ char *stream_ReadLine( stream_t *s )
char *p_line = NULL; char *p_line = NULL;
int i_line = 0, i_read = 0; int i_line = 0, i_read = 0;
while( i_read < STREAM_LINE_MAX ) for( ;; )
{ {
char *psz_eol; char *psz_eol;
const uint8_t *p_data; const uint8_t *p_data;
...@@ -1615,6 +1615,9 @@ char *stream_ReadLine( stream_t *s ) ...@@ -1615,6 +1615,9 @@ char *stream_ReadLine( stream_t *s )
if( i_data <= 0 ) break; /* Hmmm */ if( i_data <= 0 ) break; /* Hmmm */
i_line += i_data; i_line += i_data;
i_read += i_data; i_read += i_data;
if( i_read >= STREAM_LINE_MAX )
goto error; /* line too long */
} }
if( i_read > 0 ) if( i_read > 0 )
......
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