- Joined
- Jul 30, 2005
- Messages
- 176
- Reaction score
- 110
so if it is possible you could share the code to fix the bug that crashes the DataServer ?? % n,% s,% d when used in frindsystem and cashshop gift.
This is not even close to a great solution, but it avoid the crashes, as intended. The Friend System is not crashing when % sign is typed. Can you be more specific?
StdAfx.h
Code:
#include <boost/algorithm/string/replace.hpp>
DSprotocol.cpp
Code:
void CDataServerProtocol::ReqInGameShopItemGift(short aIndex, ISHOP_ITEM_GIFT *aRecv)
{
std::string strMessage;
...
strMessage = aRecv->Message;
boost::replace_all(strMessage, "%", "%%");
this->m_ItemShopDB.ExecQuery("EXEC WZ_IBS_AddGift '%s', %d, %d, %d, %d, '%s', '%s'", aRecv->TargetName, aRecv->ID1, aRecv->ID2, aRecv->ID3, 2, aRecv->Name, strMessage.c_str());
...
}
void CDataServerProtocol::ReqInGameShopPackageGift(short aIndex, LPBYTE aRecv)
{
std::string strMessage;
...
strMessage = lpMsg->Message;
boost::replace_all(strMessage, "%", "%%");
for(int i=0;i<lpMsg->Count;i++)
{
lpItem = (ISHOP_ITEM_PACKAGE *)(aRecv + sizeof(ISHOP_ITEM_GIFT_PACKAGE) + i * sizeof(ISHOP_ITEM_PACKAGE));
this->m_ItemShopDB.ExecQuery("EXEC WZ_IBS_AddGift '%s', %d, %d, %d, %d, '%s', '%s'",
lpMsg->TargetName, lpItem->ID1, lpItem->ID2, lpItem->ID3,
2, lpMsg->Name, strMessage.c_str());
...
}
-- Edit --
Friend System uses Binary storage, so it is not affected by % sign.
Code:
wsprintf(szMsg, "UPDATE T_FriendMail SET Subject=? where MemoIndex=%d AND GUID=%d", memo_index, guid);
this->m_MailDB.SetAsBinary(szMsg, (LPBYTE)lpMemoSendHdr->Subject, 60);
...
wsprintf(szMsg, "UPDATE T_FriendMail SET Memo=? where MemoIndex=%d AND GUID=%d", memo_index, guid);
this->m_MailDB.SetAsBinary(szMsg, (LPBYTE)sMemo, memo_size);
[]'s
Last edited: