From 9748d3916936cca40d902a9b27b03152d7f6d22e Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Sun, 14 Jun 2020 20:11:59 -0400 Subject: [PATCH] Resolved dangerous usage of c_str(). The value returned by c_str() is invalid after this call --- src/drivers/sdl/input.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index 3943f35f..f4246e96 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -446,7 +446,6 @@ static void KeyboardCommands (void) { int is_shift, is_alt; - char *movie_fname = ""; // get the keyboard input // check if the family keyboard is enabled @@ -573,10 +572,9 @@ static void KeyboardCommands (void) { if (is_shift) { - movie_fname = - const_cast (FCEU_MakeFName (FCEUMKF_MOVIE, 0, 0).c_str ()); - FCEUI_printf ("Recording movie to %s\n", movie_fname); - FCEUI_SaveMovie (movie_fname, MOVIE_FLAG_NONE, L""); + std::string movie_fname = FCEU_MakeFName (FCEUMKF_MOVIE, 0, 0); + FCEUI_printf ("Recording movie to %s\n", movie_fname.c_str() ); + FCEUI_SaveMovie(movie_fname.c_str() , MOVIE_FLAG_NONE, L""); } else {