From c92efacebea2ce99c93109a7e7399cd9a5f7ae68 Mon Sep 17 00:00:00 2001 From: meleu Date: Fri, 19 Aug 2016 10:13:33 -0300 Subject: [PATCH] avoid problems if ROM name has percents As @Alcaro noted here: https://github.com/libretro/RetroArch/pull/3407 --- libretro-common/file/file_path.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index ae970d9a8a..e9100d8cc0 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -439,13 +439,13 @@ void fill_dated_filename(char *out_filename, void fill_str_dated_filename(char *out_filename, const char *in_str, const char *ext, size_t size) { - char format[PATH_MAX_LENGTH] = {0}; + char format[256] = {0}; time_t cur_time; time(&cur_time); - snprintf(format, sizeof(format), - "%s-%%y%%m%%d-%%H%%M%%S.", in_str); - strftime(out_filename, size, format, localtime(&cur_time)); + strncpy(out_filename, in_str, size); + strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", localtime(&cur_time)); + strlcat(out_filename, format, size); strlcat(out_filename, ext, size); }