added a ending 0 to form a proper string in gpg cert export

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2306 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-02-13 22:45:25 +00:00
parent 6daa5809c7
commit 7a10cd6c95

View File

@ -1137,7 +1137,14 @@ std::string AuthGPG::SaveCertificateToString(std::string id)
size_t len = 0; size_t len = 0;
char *export_txt = gpgme_data_release_and_get_mem(gpgmeData, &len); char *export_txt = gpgme_data_release_and_get_mem(gpgmeData, &len);
tmp = std::string(export_txt,len);
char *str = new char[len+1] ;
memcpy(str,export_txt,len) ;
str[len]=0 ;
tmp = std::string(str);
delete[] str ;
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "Exported Certificate: " << std::endl << tmp << std::endl; std::cerr << "Exported Certificate: " << std::endl << tmp << std::endl;