[flac-dev] [PATCH] Fix buffer overflow in metaflac

Brian Willoughby brianw at sounds.wa.com
Thu Apr 5 14:30:51 PDT 2012


Agreed.  I was going to suggest memcpy() or something equivalent,  
because the FLAC structure is not literally a C string, but rather a  
32-bit field that may or may not have a terminating NULL.  Erik's  
code should work correctly in all cases.


On Apr 5, 2012, at 04:02, Erik de Castro Lopo wrote:
> I actually think that this is a better solution:
>
>                                 if(strlen(r) == 4) {
> -                                       strcpy(out->entries 
> [entry].application_id, r);
> +                                       memcpy(out->entries 
> [entry].application_id, r, 4);
>                                 }





More information about the flac-dev mailing list