diff --git a/libavformat/mov.c b/libavformat/mov.c index f81b1092f2..bb1858886c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -816,8 +816,8 @@ static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time) timet = time; ptm = gmtime(&timet); if (!ptm) return; - strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm); - av_dict_set(metadata, "creation_time", buffer, 0); + if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm)) + av_dict_set(metadata, "creation_time", buffer, 0); } } diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 9d7f2fffcd..b01dd0c5b7 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1877,7 +1877,8 @@ static int mxf_timestamp_to_str(uint64_t timestamp, char **str) *str = av_mallocz(32); if (!*str) return AVERROR(ENOMEM); - strftime(*str, 32, "%Y-%m-%d %H:%M:%S", &time); + if (!strftime(*str, 32, "%Y-%m-%d %H:%M:%S", &time)) + str[0] = '\0'; return 0; } diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 5012890ef3..de3c93158c 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -389,7 +389,8 @@ static int filetime_to_iso8601(char *buf, int buf_size, int64_t value) struct tm *tm = gmtime(&t); if (!tm) return -1; - strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm); + if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm)) + return -1; return 0; } @@ -403,7 +404,8 @@ static int crazytime_to_iso8601(char *buf, int buf_size, int64_t value) struct tm *tm = gmtime(&t); if (!tm) return -1; - strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm); + if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm)) + return -1; return 0; } @@ -417,7 +419,8 @@ static int oledate_to_iso8601(char *buf, int buf_size, int64_t value) struct tm *tm= gmtime(&t); if (!tm) return -1; - strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm); + if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm)) + return -1; return 0; }