Skip to content

Commit

Permalink
getEnigmaVersionString() returns a pointer to an invalid memory locat…
Browse files Browse the repository at this point in the history
…ion, as std::string goes out of scope
  • Loading branch information
zakalibit authored and pieterg committed Oct 16, 2013
1 parent 26db75f commit 868779c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions main/enigma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ void runMainloop()

const char *getEnigmaVersionString()
{
std::string date = enigma2_date;
std::string branch = enigma2_branch;
return std::string(date + '-' + branch).c_str();
return enigma2_version;
}

const char *getBoxType()
Expand Down
1 change: 1 addition & 0 deletions main/version_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ const char *enigma2_branch = ENIGMA2_BRANCH;
#endif
const char *enigma2_rev = ENIGMA2_REV;

const char *enigma2_version = (ENIGMA2_COMMIT_DATE "-" ENIGMA2_BRANCH);
1 change: 1 addition & 0 deletions main/version_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
extern const char *enigma2_date;
extern const char *enigma2_branch;
extern const char *enigma2_rev;
extern const char *enigma2_version;

#endif

0 comments on commit 868779c

Please sign in to comment.