(this is one reason the string class having an implicit cast to char* is
bad; lots of things compile but don't work, causing bugs like this)
This commit is contained in:
Glenn Maynard
2006-09-18 21:55:07 +00:00
parent bca66d4e27
commit 0efbe866de
+1 -1
View File
@@ -337,7 +337,7 @@ void RSAKey::Fingerprint( char *str, int len ) const
strncpy(str, buffer, len);
str[len - 1] = '\0';
slen = strlen(str);
if (this->comment && slen < len - 1)
if (!this->comment.empty() && slen < len - 1)
{
str[slen] = ' ';
strncpy(str + slen + 1, this->comment, len - slen - 1);