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

Submitted by Michael Niedermayer on July 10, 2019, 8:26 a.m.

Details

Message ID 20190710082602.GS3118@michaelspb
State New
Headers show

Commit Message

Michael Niedermayer July 10, 2019, 8:26 a.m.
On Tue, Jul 09, 2019 at 10:46:14PM +0100, Cameron Cawley wrote:
> The second use of strcpy() that this patch fixes was added in
> commit 0e9c01f.

the first strcpy is added by:

commit ee32e12ccb0d2af99c356ff7730ecfa07fd5c945
Author: Cameron Cawley <ccawley2011@gmail.com>
Date:   Thu Jun 27 20:56:02 2019 +0100

    avformat/rpl: Support files containing Replay IMA ADPCM audio
    
    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>


Its not good to apply patches which add bad code just to remove it
again in the next commit

ill apply the strcpy hunk which (should) apply to git master

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 17b45e3a67..c28ae696ac 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -189,7 +190,9 @@  static int rpl_read_header(AVFormatContext *s)
 
     // ARMovie supports multiple audio tracks; I don't have any
     // samples, though. This code will ignore additional tracks.
-    audio_format = read_line_and_int(pb, &error);  // audio format ID
+    error |= read_line(pb, line, sizeof(line));
+    audio_format = read_int(line, &endptr, &error);  // audio format ID
+    strcpy(audio_codec, endptr);
     if (audio_format) {
         ast = avformat_new_stream(s, NULL);
         if (!ast)