[FFmpeg-devel] [PATCH] Store Major brand, Minor version and compatible brands of a mov file using the metadata API

Reimar Döffinger Reimar.Doeffinger
Wed Sep 9 12:18:20 CEST 2009


On Wed, Sep 09, 2009 at 12:44:00AM -0700, Baptiste Coudurier wrote:
> On 09/09/2009 12:03 AM, haim alon wrote:
> > Since we are dealing with string (4 characters) I think using the strlcpy is
> > more suitable.
> > This also inserts the NULL terminator at the end of the destination string.
> 
> We are dealing with uint32_t here, and you are reading one byte too much.

No, at least av_strlcpy reads at most "size-1" bytes, 4 in this case.
The problem is with the return value of it:
return len + strlen(src) - 1;
So my suggestion to replace strncpy with av_strlcpy actually completely
broke things, (av_)strlcpy can only be used for correctly 0-terminated
strings, and I fear that this is used wrongly in some places in
FFmpeg, e.g. rtmppkt.c looks suspicious.



More information about the ffmpeg-devel mailing list