[vlc-commits] commit: LUA: make one byte room for the nul terminator after iconv() ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Fri Jun 25 07:07:49 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jun 25 08:07:01 2010 +0300| [51304fe91b9f24e4dec96d133eea9be16797e308] | committer: Rémi Denis-Courmont 

LUA: make one byte room for the nul terminator after iconv()

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

 modules/misc/lua/libs/strings.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/misc/lua/libs/strings.c b/modules/misc/lua/libs/strings.c
index a43e972..7eb6413 100644
--- a/modules/misc/lua/libs/strings.c
+++ b/modules/misc/lua/libs/strings.c
@@ -128,8 +128,8 @@ static int vlclua_iconv( lua_State *L )
 
     if( iconv_handle == (vlc_iconv_t)-1 )
        return vlclua_error( L );
-    psz_output = psz_original = malloc( 4 * i_in_bytes );
     i_out_bytes = 4 * i_in_bytes;
+    psz_output = psz_original = malloc( i_out_bytes + 1 );
     i_ret = vlc_iconv( iconv_handle, &psz_input ,
                        &i_in_bytes, &psz_output, &i_out_bytes );
     *psz_output = '\0';



More information about the vlc-commits mailing list