| RoseKavalier   
   Posts: 118
 
 | 
			| 
 
				
Code:
 std::string tr (const char *key, const std::vector<std::string> params = {}) {const int MAX_PARAMS = 64;
 const char* _params[MAX_PARAMS];
 int numParams = params.size() <= MAX_PARAMS ? params.size() : MAX_PARAMS;
 
 for (int i = 0; i < numParams; i++) {
 _params[i] = params[i].c_str();
 }
 
 char* buf = _tr(key, _params, numParams - 1);
 MemFree(buf);
 
 return buf;
 }
 
This function is undefined behaviour.  
It returns buf  which was just MemFree , this is definitely not safe.
 
Thanks for the addresses!
 
My question related to CN-specifically was what encoding the game used... GB or GBK codepage 936.
			 |  | 
	| 17.06.2020 01:50 |  |