[FFmpeg-devel] [PATCH 1/2] avformat/rpl: Replace strcpy with av_strlcpy

Michael Niedermayer michael at niedermayer.cc
Fri Jul 5 19:18:05 EEST 2019


On Sun, Jun 30, 2019 at 12:00:43AM +0100, Cameron Cawley wrote:
> ---
>  libavformat/rpl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/rpl.c b/libavformat/rpl.c
> index b4859320f4..579ab4f57e 100644
> --- a/libavformat/rpl.c
> +++ b/libavformat/rpl.c
> @@ -192,7 +192,7 @@ static int rpl_read_header(AVFormatContext *s)
>      // samples, though. This code will ignore additional tracks.
>      error |= read_line(pb, line, sizeof(line));
>      audio_format = read_int(line, &endptr, &error);  // audio format ID
> -    strcpy(audio_codec, endptr);
> +    av_strlcpy(audio_codec, endptr, RPL_LINE_LENGTH);
>      if (audio_format) {
>          ast = avformat_new_stream(s, NULL);
>          if (!ast)
> @@ -203,7 +203,7 @@ static int rpl_read_header(AVFormatContext *s)
>          ast->codecpar->channels        = read_line_and_int(pb, &error);  // number of audio channels
>          error |= read_line(pb, line, sizeof(line));
>          ast->codecpar->bits_per_coded_sample = read_int(line, &endptr, &error);  // audio bits per sample
> -        strcpy(audio_type, endptr);
> +        av_strlcpy(audio_type, endptr, RPL_LINE_LENGTH);
>          // At least one sample uses 0 for ADPCM, which is really 4 bits
>          // per sample.
>          if (ast->codecpar->bits_per_coded_sample == 0)

please include this in the patch that adds the strcpy()

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190705/6b3390ef/attachment.sig>


More information about the ffmpeg-devel mailing list