summaryrefslogtreecommitdiff
path: root/libavformat/mxfdec.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/mxfdec.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/mxfdec.c')
-rw-r--r--libavformat/mxfdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9aedd477f4..ff88f919a6 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1735,7 +1735,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;
}