[vlc-commits] misc: acoustid: fix mbz string copy

Francois Cartegnie git at videolan.org
Mon Oct 6 13:59:14 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct  6 13:58:06 2014 +0200| [86723f349d950f20494723e54959821ae28f2a1f] | committer: Francois Cartegnie

misc: acoustid: fix mbz string copy

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

 modules/misc/webservices/acoustid.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/misc/webservices/acoustid.c b/modules/misc/webservices/acoustid.c
index edbe47d..f6da2fb 100644
--- a/modules/misc/webservices/acoustid.c
+++ b/modules/misc/webservices/acoustid.c
@@ -81,7 +81,11 @@ static void parse_recordings( vlc_object_t *p_obj, json_value *node, acoustid_re
             record->psz_title = strdup( value->u.string.ptr );
         value = jsongetbyname( recordnode, "id" );
         if ( value && value->type == json_string )
-            memcpy( record->s_musicbrainz_id, value->u.string.ptr, MB_ID_SIZE );
+        {
+            size_t i_len = strlen( value->u.string.ptr );
+            i_len = __MIN( i_len, MB_ID_SIZE );
+            memcpy( record->s_musicbrainz_id, value->u.string.ptr, i_len );
+        }
         parse_artists( jsongetbyname( recordnode, "artists" ), record );
         msg_Dbg( p_obj, "recording %d title %s %36s %s", i, record->psz_title, record->s_musicbrainz_id, record->psz_artist );
     }



More information about the vlc-commits mailing list