[vlc-commits] acoustid: use memcpy (cid #1062538)

Francois Cartegnie git at videolan.org
Fri Oct 3 15:40:51 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct  3 14:17:59 2014 +0200| [242d1c2e0b820fe1fc793fab156b444b7a16162e] | committer: Francois Cartegnie

acoustid: use memcpy (cid #1062538)

strncpy triggers warning because the
struct is nonzero terminated.

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

 modules/misc/fingerprinter.c        |    2 +-
 modules/misc/webservices/acoustid.c |    4 ++--
 modules/misc/webservices/acoustid.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/misc/fingerprinter.c b/modules/misc/fingerprinter.c
index 6beb81b..21e9f1e 100644
--- a/modules/misc/fingerprinter.c
+++ b/modules/misc/fingerprinter.c
@@ -328,7 +328,7 @@ static void fill_metas_with_results( fingerprint_request_t *p_r, acoustid_finger
             {
                 vlc_meta_Set( p_meta, vlc_meta_Title, p_record->psz_title );
                 vlc_meta_Set( p_meta, vlc_meta_Artist, p_record->psz_artist );
-                vlc_meta_AddExtra( p_meta, "musicbrainz-id", p_record->sz_musicbrainz_id );
+                vlc_meta_AddExtra( p_meta, "musicbrainz-id", p_record->s_musicbrainz_id );
                 vlc_array_append( & p_r->results.metas_array, p_meta );
             }
         }
diff --git a/modules/misc/webservices/acoustid.c b/modules/misc/webservices/acoustid.c
index f23be5a..edbe47d 100644
--- a/modules/misc/webservices/acoustid.c
+++ b/modules/misc/webservices/acoustid.c
@@ -81,9 +81,9 @@ 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 )
-            strncpy( record->sz_musicbrainz_id, value->u.string.ptr, MB_ID_SIZE );
+            memcpy( record->s_musicbrainz_id, value->u.string.ptr, MB_ID_SIZE );
         parse_artists( jsongetbyname( recordnode, "artists" ), record );
-        msg_Dbg( p_obj, "recording %d title %s %36s %s", i, record->psz_title, record->sz_musicbrainz_id, record->psz_artist );
+        msg_Dbg( p_obj, "recording %d title %s %36s %s", i, record->psz_title, record->s_musicbrainz_id, record->psz_artist );
     }
 }
 
diff --git a/modules/misc/webservices/acoustid.h b/modules/misc/webservices/acoustid.h
index 313ad09..d7d54c9 100644
--- a/modules/misc/webservices/acoustid.h
+++ b/modules/misc/webservices/acoustid.h
@@ -24,7 +24,7 @@ struct musicbrainz_recording_t
 {
     char *psz_artist;
     char *psz_title;
-    char sz_musicbrainz_id[MB_ID_SIZE];
+    char s_musicbrainz_id[MB_ID_SIZE];
 };
 typedef struct musicbrainz_recording_t musicbrainz_recording_t;
 



More information about the vlc-commits mailing list