[vlc-commits] stream_ReadLine: correctly return an error on overflow (fixes #7361)
Rémi Denis-Courmont
git at videolan.org
Thu Apr 25 21:20:48 CEST 2013
vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Apr 25 18:04:07 2013 +0300| [62e9da1477b7e6ceb6aaaa91022f5c850832d8dc] | committer: Felix Paul Kühne
stream_ReadLine: correctly return an error on overflow (fixes #7361)
(cherry picked from commit 5e7e45dead26528d648a645b907df877100ecc31)
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=62e9da1477b7e6ceb6aaaa91022f5c850832d8dc
---
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 1800195..e41670d 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;
@@ -1615,6 +1615,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 )
More information about the vlc-commits
mailing list