[vlc-commits] stream: fix off-by-one

Rémi Denis-Courmont git at videolan.org
Sun Nov 12 14:25:43 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 12 13:41:16 2017 +0200| [297e6f4fd4c08ef15f0419a970f8e6214137c8e3] | committer: Rémi Denis-Courmont

stream: fix off-by-one

One byte is (potentially) needed to append the final nul.

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

 src/input/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index affc7b2c0d..07f3f886f7 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -318,7 +318,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 
             /* iconv */
             /* UTF-8 needs at most 150% of the buffer as many as UTF-16 */
-            i_new_line = i_line * 3 / 2;
+            i_new_line = i_line * 3 / 2 + 1;
             psz_new_line = malloc( i_new_line );
             if( psz_new_line == NULL )
                 goto error;



More information about the vlc-commits mailing list