]> git.sesse.net Git - ffmpeg/commit
avformat/dashdec: Ensure strings are zero-terminated
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 2 Mar 2021 10:20:29 +0000 (11:20 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 2 Mar 2021 10:49:10 +0000 (11:49 +0100)
commitec5663d0a796cb8acde8ad04ac4cc7e2be7d5173
tree57dd0ba3d3cd703d17cffcb76c3cc07d4a017bd5
parent988deae6da70e3c24d8e75d75e300e49981599b7
avformat/dashdec: Ensure strings are zero-terminated

strncpy only ensures that one does not write beyond the end of the
destination buffer; in case of truncation it does not zero-terminate
the destination buffer. This makes using it the way it is now in the
DASH demuxer dangerous. So use av_strlcpy instead.

Also don't write anything if there is no id: The buffer has already been
zeroed initially.

The DASH testset from the Universität Klagenfurt contains samples with
ids that are too long. E.g.
http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/dashdec.c