[FFmpeg-devel] [PATCH] File concat protocol

Wolfram Gloger wmglo
Sun Jun 24 22:00:44 CEST 2007


> From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= <mans at mansr.com>
> 
> Michael Niedermayer <michaelni at gmx.at> writes:
> 
> >> +    av_strstart(filename, "cat:", &filename);
> >> +
> >> +    for (;;) {
> >> +        for (len=0; filename[len] && filename[len]!=AV_CAT_SEPARATOR; ++len);
> 
> This could use strchr().
> 
> >> +        if (len == 0)
> >> +            break;
> >> +        fn = av_malloc(len+1);
> >> +        strncpy(fn, filename, len);
> >
> > shouldnt av_strlcpy() be used here?
> 
> strncpy() certainly won't do the right thing (it rarely does).

It will do the right thing here -- check the context, in particular
the following lines.

> av_strlcpy(fn, filename, len+1) should work, even though it's not the
> typical use case.

Ok, although I tend to prefer standard string functions.

Regards,
Wolfram.




More information about the ffmpeg-devel mailing list