[vlc-devel] commit: libvlc: Fix a (tiny) buffer overflow and fix #2449 ( Rémi Duraffort )

git version control git at videolan.org
Mon Jan 26 16:13:51 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Jan 26 16:10:54 2009 +0100| [02bf31b454b00631e2a97642ef3b5a195866ec09] | committer: Rémi Duraffort 

libvlc: Fix a (tiny) buffer overflow and fix #2449

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

 src/libvlc.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index e9e43bb..f297420 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -864,9 +864,12 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
     if( psz_modules && *psz_modules && psz_control && *psz_control )
     {
-        psz_modules = (char *)realloc( psz_modules, strlen( psz_modules ) +
-                                                    strlen( psz_control ) + 1 );
-        sprintf( psz_modules, "%s:%s", psz_modules, psz_control );
+        char* psz_tmp;
+        if( asprintf( &psz_tmp, "%s:%s", psz_modules, psz_control ) != -1 )
+        {
+            free( psz_modules );
+            psz_modules = psz_tmp;
+        }
     }
     else if( psz_control && *psz_control )
     {




More information about the vlc-devel mailing list