validate post to promote. fix #34

This commit is contained in:
Miguel Freitas 2014-01-13 18:06:38 -02:00
parent ec364e9317
commit f3b9fc3148

View File

@ -1621,6 +1621,14 @@ Value setspammsg(const Array& params, bool fHelp)
string strUsername = params[0].get_str();
string strMsg = params[1].get_str();
int spamMsgUtf8Size = utf8::num_characters(strMsg.begin(), strMsg.end());
if (spamMsgUtf8Size < 0)
throw JSONRPCError(RPC_INTERNAL_ERROR, "spam message invalid utf8");
if (spamMsgUtf8Size == 0)
throw JSONRPCError(RPC_INTERNAL_ERROR, "empty spam message");
if (spamMsgUtf8Size > MAX_SPAM_MSG_SIZE)
throw JSONRPCError(RPC_INTERNAL_ERROR, "spam message too big");
strSpamUser = strUsername;
strSpamMessage = strMsg;