mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
make sure strSpamUser is valid before using it to sign message
This commit is contained in:
parent
74470ebddb
commit
d2d64bfed2
13
src/main.cpp
13
src/main.cpp
@ -70,7 +70,7 @@ int64 nHPSTimerStart = 0;
|
|||||||
int64 nTransactionFee = 0;
|
int64 nTransactionFee = 0;
|
||||||
|
|
||||||
string strSpamMessage = "Promoted posts are needed to run the network infrastructure. If you want to help, start generating blocks and advertise. [en]";
|
string strSpamMessage = "Promoted posts are needed to run the network infrastructure. If you want to help, start generating blocks and advertise. [en]";
|
||||||
string strSpamUser = "nobody"; // [MF] FIXME: authenticy check needed
|
string strSpamUser = "nobody";
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -3581,14 +3581,15 @@ static bool CreateSpamMsgTx(CTransaction &txNew, std::vector<unsigned char> &sal
|
|||||||
std::string strUsername = strSpamUser;
|
std::string strUsername = strSpamUser;
|
||||||
|
|
||||||
CKeyID keyID;
|
CKeyID keyID;
|
||||||
if( strSpamUser != "nobody" && !pwalletMain->GetKeyIdFromUsername(strSpamUser, keyID) ) {
|
if( strSpamUser != "nobody" ) {
|
||||||
if( pwalletMain->vchDefaultKey.IsValid() ) {
|
// check both wallet and block chain if they know about this user
|
||||||
keyID = pwalletMain->vchDefaultKey.GetID();
|
uint256 txid = SerializeHash(make_pair(strSpamUser,-1));
|
||||||
strUsername = pwalletMain->mapKeyMetadata[keyID].username;
|
if( !pblocktree->HaveTxIndex(txid) ||
|
||||||
} else {
|
!pwalletMain->GetKeyIdFromUsername(strSpamUser, keyID) ) {
|
||||||
strUsername = "nobody";
|
strUsername = "nobody";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("CreateSpamMsgTx: keyId = %s\n", keyID.ToString().c_str() );
|
printf("CreateSpamMsgTx: keyId = %s\n", keyID.ToString().c_str() );
|
||||||
|
|
||||||
// compute message hash and sign it
|
// compute message hash and sign it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user