ffmpeg_opt: Check for localtime() failure
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Jun 2015 13:36:20 +0000 (15:36 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Jun 2015 13:36:20 +0000 (15:36 +0200)
Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg_opt.c

index 1c5794c..79cb5ca 100644 (file)
@@ -2438,6 +2438,9 @@ static int opt_vstats(void *optctx, const char *opt, const char *arg)
     time_t today2 = time(NULL);
     struct tm *today = localtime(&today2);
 
     time_t today2 = time(NULL);
     struct tm *today = localtime(&today2);
 
+    if (!today)
+        return AVERROR(errno);
+
     snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
              today->tm_sec);
     return opt_vstats_file(NULL, opt, filename);
     snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
              today->tm_sec);
     return opt_vstats_file(NULL, opt, filename);