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

Aurelien Jacobs aurel
Sat Feb 14 15:00:21 CET 2009


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().

Aurel




More information about the ffmpeg-devel mailing list