diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-19 22:10:47 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-19 22:10:47 +0100 |
commit | b2bbe8298ba5416f26ffadb43f9e75997ec02f7f (patch) | |
tree | 192fab7434404f25ce8b04e3d1e55430f0eef355 /libavformat/dss.c | |
parent | 29d2197d880538550812db720539f8c4c4e89dc3 (diff) | |
download | ffmpeg-b2bbe8298ba5416f26ffadb43f9e75997ec02f7f.tar.gz |
avformat/dss: Check sscanf() return value in dss_read_metadata_date()
Fixes writing uninitialized values into metadata without error in case
parsing fails
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/dss.c')
-rw-r--r-- | libavformat/dss.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/dss.c b/libavformat/dss.c index f4355f1acb..a353ee02f9 100644 --- a/libavformat/dss.c +++ b/libavformat/dss.c @@ -78,7 +78,8 @@ static int dss_read_metadata_date(AVFormatContext *s, unsigned int offset, if (ret < DSS_TIME_SIZE) return ret < 0 ? ret : AVERROR_EOF; - sscanf(string, "%2d%2d%2d%2d%2d%2d", &y, &month, &d, &h, &minute, &sec); + if (sscanf(string, "%2d%2d%2d%2d%2d%2d", &y, &month, &d, &h, &minute, &sec) != 6) + return AVERROR_INVALIDDATA; /* We deal with a two-digit year here, so set the default date to 2000 * and hope it will never be used in the next century. */ snprintf(datetime, sizeof(datetime), "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d", |