[vlc-commits] lua: XML encode metadata before pushing it on the web interface ( closes #15866)

Felix Paul Kühne git at videolan.org
Tue Nov 24 15:59:52 CET 2015


vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Nov 24 15:37:51 2015 +0100| [15891170ddd350fdf23db182f3cb796e21e9bba1] | committer: Jean-Baptiste Kempf

lua: XML encode metadata before pushing it on the web interface (closes #15866)

(cherry picked from commit 1f5fb6194dcbb34c75d5e2ae75b56d345c937dab)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=15891170ddd350fdf23db182f3cb796e21e9bba1
---

 modules/lua/libs/input.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 2d6d835..835033a 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -117,18 +117,25 @@ static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item )
     }
 
     lua_newtable( L );
-    char *psz_name;
-    const char *psz_meta;
+    char *psz_name = NULL;
+    const char *psz_meta = NULL;
+    char *psz_meta_worker = NULL;
 
     psz_name = input_item_GetName( p_item );
+    if( psz_name != NULL )
+        psz_name = convert_xml_special_chars( psz_name );
     lua_pushstring( L, psz_name );
     lua_setfield( L, -2, "filename" );
     free( psz_name );
 
 #define PUSH_META( n, m ) \
     psz_meta = vlc_meta_Get( p_item->p_meta, vlc_meta_ ## n ); \
-    lua_pushstring( L, psz_meta ); \
-    lua_setfield( L, -2, m )
+    if( psz_meta != NULL ) { \
+        psz_meta_worker = convert_xml_special_chars( psz_meta ); \
+    } \
+    lua_pushstring( L, psz_meta_worker ); \
+    lua_setfield( L, -2, m ); \
+    FREENULL( psz_meta_worker )
 
     vlc_mutex_lock(&p_item->lock);
 



More information about the vlc-commits mailing list