summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2014-10-24 10:43:20 +0300
committerMartin Storsjö <martin@martin.st>2014-10-26 00:14:54 +0300
commit9dcf2397219ca796f0fafce2a703770d6fd09920 (patch)
treea7a43f39be7fa2e3cfd09c890a40373f0742f154 /libavformat/mov.c
parent851ace79a307bea54b44bd6f7ecd3b7861c28ec6 (diff)
lavf: Check the return value of strftime
If the buffer provided to strftime is too small, the buffer contents are indeterminate - it does not guarantee actually null terminating the buffer. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index efc9314087..a5b39f29dd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -743,8 +743,8 @@ static void mov_metadata_creation_time(AVDictionary **metadata, time_t time)
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
ptm = gmtime(&time);
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);
}
}