c++ - _free_base "Error reading register value" -
i have code test application:
char* buff = new char[0]; f_hstream.read(buff, size); string cut_header = zcrypto::from_base64( string(buff, size) ); if ( cut_header.length() == 0 ) break; const char* dec = zcrypto::decrypt( cut_header ); printf( "header >> %s\n", dec ); vector<string> header = split(string(dec), ';'); decrypt function >
const char* zcrypto::decrypt(const std::string& str_in) { const string key = zcrypto::from_base64("<base_64line_here>"); const string iv = zcrypto::from_base64("<base_64line_here>"); std::string str_out; cryptopp::cbc_mode<cryptopp::rijndael>::decryption decryption((byte*)key.c_str(), key.length(), (byte*)iv.c_str()); cryptopp::stringsource encryptor(str_in, true, new cryptopp::streamtransformationfilter(decryption, new cryptopp::stringsink(str_out) ) ); return str_out.data(); } and getting debugger error on line const char* dec = zcrypto::decrypt( cut_header );, if trying launch application without mvs debugger, crash - application has stopped working...
p.s. can't change code generation - runtime library /mt, cryptopp functions in app compiling without errors type.
decryption works fine too, whats wrong?
update:
i change
const char* zcrypto::decrypt(const std::string& str_in) { to
string zcrypto::decrypt(const std::string& str_in) { and
char* buff = new char[0]; const char* dec = zcrypto::decrypt( cut_header ); to
char* buff = new char[size]; string dec = zcrypto::decrypt( cut_header ); i'm still getting error.
this line not sound right.
char* buff = new char[0]; you need:
char* buff = new char[size];
Comments
Post a Comment