avfilter/vf_signature: use av_strlcpy()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 30 Mar 2018 00:16:31 +0000 (02:16 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 12 Apr 2018 22:35:15 +0000 (00:35 +0200)
Fixes: out of array access

Found-by: Kira <kira_cxy@foxmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 35eeff30caf34df835206f1c12bcf4b7c2bd6758)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavfilter/vf_signature.c

index 06b1b91..3b117e7 100644 (file)
@@ -573,7 +573,8 @@ static int export(AVFilterContext *ctx, StreamContext *sc, int input)
         /* error already handled */
         av_assert0(av_get_frame_filename(filename, sizeof(filename), sic->filename, input) == 0);
     } else {
-        strcpy(filename, sic->filename);
+        if (av_strlcpy(filename, sic->filename, sizeof(filename)) >= sizeof(filename))
+            return AVERROR(EINVAL);
     }
     if (sic->format == FORMAT_XML) {
         return xml_export(ctx, sc, filename);