aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-28 15:00:32 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-28 15:00:32 +0000
commit9a3358220449e75966bb188f2dc49310107b676d (patch)
tree1c69128fbaf46487b4cb554fe941f243d9ff32e6 /util.cpp
parent8a46ed83cc65707fab87f93ab59e9a611dd02a06 (diff)
downloadbitcoin-9a3358220449e75966bb188f2dc49310107b676d.tar.xz
fix unsafe string handling in wxGetTranslation
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/util.cpp b/util.cpp
index d90cdc48f9..09de89b10f 100644
--- a/util.cpp
+++ b/util.cpp
@@ -445,17 +445,17 @@ const char* wxGetTranslation(const char* pszEnglish)
return (*mi).second;
// wxWidgets translation
- const char* pszTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str();
+ wxString strTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8));
// We don't cache unknown strings because caller might be passing in a
// dynamic string and we would keep allocating memory for each variation.
- if (strcmp(pszEnglish, pszTranslated) == 0)
+ if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
return pszEnglish;
// Add to cache, memory doesn't need to be freed. We only cache because
// we must pass back a pointer to permanently allocated memory.
- char* pszCached = new char[strlen(pszTranslated)+1];
- strcpy(pszCached, pszTranslated);
+ char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
+ strcpy(pszCached, strTranslated.utf8_str());
mapCache[pszEnglish] = pszCached;
return pszCached;
}