[FFmpeg-cvslog] lavf/matroskadec: Do not use strncat() to limit copying a one-char constant.
Carl Eugen Hoyos
git at videolan.org
Tue Dec 11 01:42:50 EET 2018
ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Mon Dec 10 01:55:15 2018 +0100| [73abde61bb07a302bd1c47620f97b9d08148f158] | committer: Carl Eugen Hoyos
lavf/matroskadec: Do not use strncat() to limit copying a one-char constant.
Instead add the character to the snprintf above as suggested by Mark.
Silences a warning:
libavformat/matroskadec.c: In function 'webm_dash_manifest_cues':
libavformat/matroskadec.c:3947:13: warning: 'strncat' specified bound 1 equals source length [-Wstringop-overflow=]
strncat(buf, ",", 1);
^~~~~~~~~~~~~~~~~~~~
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73abde61bb07a302bd1c47620f97b9d08148f158
---
libavformat/matroskadec.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 2daa1dba6f..4ad99db7db 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3936,17 +3936,14 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range)
strcpy(buf, "");
for (i = 0; i < s->streams[0]->nb_index_entries; i++) {
int ret = snprintf(buf + end, 20,
- "%" PRId64, s->streams[0]->index_entries[i].timestamp);
+ "%" PRId64"%s", s->streams[0]->index_entries[i].timestamp,
+ i != s->streams[0]->nb_index_entries - 1 ? "," : "");
if (ret <= 0 || (ret == 20 && i == s->streams[0]->nb_index_entries - 1)) {
av_log(s, AV_LOG_ERROR, "timestamp too long.\n");
av_free(buf);
return AVERROR_INVALIDDATA;
}
end += ret;
- if (i != s->streams[0]->nb_index_entries - 1) {
- strncat(buf, ",", 1);
- end++;
- }
}
av_dict_set(&s->streams[0]->metadata, CUE_TIMESTAMPS, buf, 0);
av_free(buf);
More information about the ffmpeg-cvslog
mailing list