Skip to content

Commit

Permalink
Fix use after free in Main.cpp (issue yvt#846)
Browse files Browse the repository at this point in the history
Create c-string to store filepath before concatenating with output message.
  • Loading branch information
dtomlinson-ga authored Nov 27, 2019
1 parent 08e792e commit 17cd56d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Sources/Gui/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,8 @@ int main(int argc, char **argv) {
SDL_RWops *io = SDL_RWFromFile(
(home + "/.openspades/CONTENT_MOVED_TO_NEW_DIR").c_str(), "wb");
if (io != NULL) {
const char *text = ("Content of this directory moved to " +
xdg_data_home + "/openspades")
.c_str();
const char *directory = (xdg_data_home + "/openspades").c_str();
const char *text = ("Content of this directory moved to " + directory).c_str();
io->write(io, text, strlen(text), 1);
io->close(io);
}
Expand Down

0 comments on commit 17cd56d

Please sign in to comment.