]> git.sesse.net Git - ffmpeg/commitdiff
avutil/timecode: fix sscanf format string with garbage at the end
authorLimin Wang <lance.lmwang@gmail.com>
Sat, 5 Dec 2020 01:39:38 +0000 (09:39 +0800)
committerLimin Wang <lance.lmwang@gmail.com>
Sat, 16 Jan 2021 00:51:11 +0000 (08:51 +0800)
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
libavutil/timecode.c

index c1fa445d31934ec947e849e1f711c572b325fb2c..5106f642b97031d818fb6f6388ac39275f00b6a6 100644 (file)
@@ -252,7 +252,7 @@ int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *st
     char c;
     int hh, mm, ss, ff, flags;
 
-    if (sscanf(str, "%d:%d:%d%c%d", &hh, &mm, &ss, &c, &ff) != 5) {
+    if (sscanf(str, "%02u:%02u:%02u%c%02u", &hh, &mm, &ss, &c, &ff) != 5) {
         av_log(log_ctx, AV_LOG_ERROR, "Unable to parse timecode, "
                                       "syntax: hh:mm:ss[:;.]ff\n");
         return AVERROR_INVALIDDATA;