[vlc-devel] commit: Do not use sprintf without a format ( Rafaël Carré )

git version control git at videolan.org
Mon Mar 24 02:04:35 CET 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Mar 24 01:04:38 2008 +0000| [89561739811489168220ce3a11f6b431c2544c2f]

Do not use sprintf without a format

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

 src/text/strings.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/text/strings.c b/src/text/strings.c
index 896b225..aebefe0 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -659,7 +659,8 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
     int b_empty_if_na = 0;
     char buf[10];
     int i_size = strlen( string ) + 1; /* +1 to store '\0' */
-    char *dst = malloc( i_size );
+    char *dst = strdup( string );
+    if( !dst ) return NULL;
     int d = 0;
 
     playlist_t *p_playlist = pl_Yield( p_object );
@@ -672,8 +673,6 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
         p_item = input_GetItem(p_input);
     }
 
-    sprintf( dst, string );
-
     while( *s )
     {
         if( b_is_format )




More information about the vlc-devel mailing list