From 248dbba88d0897490a46b8fcc069c144088b7cb3 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Thu, 23 Apr 2015 23:57:06 -0700 Subject: [PATCH] Video: Fix an issue with very long filenames --- CHANGES | 1 + src/platform/ffmpeg/ffmpeg-encoder.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 9bd617d89..554b0f3db 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ Bugfixes: - Util: Fix resource leak in UTF-8 handling code - VFS: Fix resource leaks if some allocations fail - Debugger: Fix boundary conditions in tab completion + - Video: Fix an issue with very long filenames Misc: - Qt: Show multiplayer numbers in window title - Qt: Solar sensor can have shortcuts set diff --git a/src/platform/ffmpeg/ffmpeg-encoder.c b/src/platform/ffmpeg/ffmpeg-encoder.c index 5d19bfd8c..22c7381f8 100644 --- a/src/platform/ffmpeg/ffmpeg-encoder.c +++ b/src/platform/ffmpeg/ffmpeg-encoder.c @@ -202,7 +202,8 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) { avformat_alloc_output_context2(&encoder->context, oformat, 0, outfile); #else encoder->context = avformat_alloc_context(); - strncpy(encoder->context->filename, outfile, sizeof(encoder->context->filename)); + strncpy(encoder->context->filename, outfile, sizeof(encoder->context->filename) - 1); + encoder->context->filename[sizeof(encoder->context->filename) - 1] = '\0'; encoder->context->oformat = oformat; #endif