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

Rémi Denis-Courmont remi at remlab.net
Mon Oct 6 14:54:21 CEST 2014


Le 2014-10-06 14:59, git at videolan.org a écrit :
> 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 );

That's called strncpy()...

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list