mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-10 06:48:07 +00:00
fix listusernamespartial: search string must be shorter than username being compared (or equal). not longer.
This commit is contained in:
parent
8d793b371d
commit
432535bd6d
@ -1569,9 +1569,11 @@ Value listusernamespartial(const Array& params, bool fHelp)
|
|||||||
BOOST_FOREACH(const PAIRTYPE(CKeyID, CKeyMetadata)& item, pwalletMain->mapKeyMetadata) {
|
BOOST_FOREACH(const PAIRTYPE(CKeyID, CKeyMetadata)& item, pwalletMain->mapKeyMetadata) {
|
||||||
LOCK(cs_twister);
|
LOCK(cs_twister);
|
||||||
BOOST_FOREACH(const string &user, m_users[item.second.username].m_following) {
|
BOOST_FOREACH(const string &user, m_users[item.second.username].m_following) {
|
||||||
if( exact_match && userStartsWith.size() != user.size() )
|
if( (exact_match && userStartsWith.size() != user.size()) ||
|
||||||
break;
|
userStartsWith.size() > user.size() ) {
|
||||||
int toCompare = std::min( userStartsWith.size(), user.size() );
|
continue;
|
||||||
|
}
|
||||||
|
int toCompare = userStartsWith.size();
|
||||||
if( memcmp( user.data(), userStartsWith.data(), toCompare ) == 0 )
|
if( memcmp( user.data(), userStartsWith.data(), toCompare ) == 0 )
|
||||||
retStrings.insert( user );
|
retStrings.insert( user );
|
||||||
if( retStrings.size() >= count )
|
if( retStrings.size() >= count )
|
||||||
@ -1589,9 +1591,11 @@ Value listusernamespartial(const Array& params, bool fHelp)
|
|||||||
BOOST_FOREACH(const CTransaction&tx, block.vtx) {
|
BOOST_FOREACH(const CTransaction&tx, block.vtx) {
|
||||||
if( !tx.IsSpamMessage() ) {
|
if( !tx.IsSpamMessage() ) {
|
||||||
string txUsername = tx.userName.ExtractSmallString();
|
string txUsername = tx.userName.ExtractSmallString();
|
||||||
if( exact_match && userStartsWith.size() != txUsername.size() )
|
if( (exact_match && userStartsWith.size() != txUsername.size()) ||
|
||||||
break;
|
userStartsWith.size() > txUsername.size() ) {
|
||||||
int toCompare = std::min( userStartsWith.size(), txUsername.size() );
|
continue;
|
||||||
|
}
|
||||||
|
int toCompare = userStartsWith.size();
|
||||||
if( memcmp( txUsername.data(), userStartsWith.data(), toCompare ) == 0 )
|
if( memcmp( txUsername.data(), userStartsWith.data(), toCompare ) == 0 )
|
||||||
retStrings.insert( txUsername );
|
retStrings.insert( txUsername );
|
||||||
if( retStrings.size() >= count )
|
if( retStrings.size() >= count )
|
||||||
|
Loading…
Reference in New Issue
Block a user