[FFmpeg-devel] [PATCH] ffplay.c: Use av_strlcpy

Stefano Sabatini stefano.sabatini-lala
Sat Feb 14 20:27:53 CET 2009


On date Saturday 2009-02-14 15:00:21 +0100, Aurelien Jacobs encoded:
> Patrik Kullman wrote:
> 
> > Prevents compilation warning:
> > 
> > ffplay.c: In function ?main?:
> > ffplay.c:2607: warning: assignment discards qualifiers from pointer
> > target type
> > 
> > Index: ffplay.c
> > ===================================================================
> > --- ffplay.c	(revision 17221)
> > +++ ffplay.c	(working copy)
> > @@ -2604,7 +2604,7 @@
> >      SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
> >  
> >      av_init_packet(&flush_pkt);
> > -    flush_pkt.data= "FLUSH";
> > +    av_strlcpy(flush_pkt.data, "FLUSH", 5);
> 
> This looks wrong. flush_pkt.data is never assigned and thus, is
> pointing to random memory.
> If you want to do this, you should also use av_new_packet() and
> av_destruct_packet() instead of av_init_packet().

This has been already discussed:
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/77996

and looks like we should keep that warning, or you may try to convince
the $compiler_of_your_choice folks to support a pragma for disabling
warnings...

Regards.
-- 
FFmpeg = Fiendish & Faithless Merciless Prodigious Excellent Gadget




More information about the ffmpeg-devel mailing list