Commit 5e7e45de authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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

parent c10e43a9
......@@ -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 )
......
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