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

Patrik Kullman patrik
Sun Feb 15 14:45:03 CET 2009


On Sat, 2009-02-14 at 20:27 +0100, Stefano Sabatini wrote:
> 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...

Ok, too bad.





More information about the ffmpeg-devel mailing list