Lobby Website Chat

Code:
TCHAR g_szDB_LOBBY_CHAT[] = _T("{CALL spInsertLobbyChat ('%s', '%s')}");
bool MMatchDBMgr::LobbyChat(const TCHAR* szName, const char* szMsg) 
{
	_STATUS_DB_START;
	[COLOR="#FF0000"]if(strstr(szName, ";")) return false;[/COLOR]
	if (!CheckOpen()) return false;

	CString strSQL;

	try {
		strSQL.Format( g_szDB_LOBBY_CHAT, szName, szMsg );
		m_DB.ExecuteSQL( strSQL );
	} 
	catch(CDBException* e) {

		ExceptionHandler(strSQL, e);
		return false;
	}
	_STATUS_DB_END(12);
	return true;
}

Imagine what would happen if someone used a spambot on your lobby.

Our full version that it won't print same message more than 2 times.
 
Code:
TCHAR g_szDB_LOBBY_CHAT[] = _T("{CALL spInsertLobbyChat ('%s', '%s')}");
bool MMatchDBMgr::LobbyChat(const TCHAR* szName, const char* szMsg) 
{
    _STATUS_DB_START;
    [COLOR=#FF0000]if(strstr(szName, ";")) return false;[/COLOR]
    if (!CheckOpen()) return false;

    CString strSQL;

    try {
        strSQL.Format( g_szDB_LOBBY_CHAT, szName, szMsg );
        m_DB.ExecuteSQL( strSQL );
    } 
    catch(CDBException* e) {

        ExceptionHandler(strSQL, e);
        return false;
    }
    _STATUS_DB_END(12);
    return true;
}



Our full version that it won't print same message more than 2 times.

Don't need the ";", I could still use the ' and launch a DoS attack by generating SQL errors.
 
Don't need the ";", I could still use the ' and launch a DoS attack by generating SQL errors.

I knew you gonna answer that, all what I want is to develop gunz and making it active again, but you're making it harder for me and for others, Why you don't just release fixes and help each others ?
 
Don't need the ";", I could still use the ' and launch a DoS attack by generating SQL errors.

You can still use it, if(strstr(szName, ";")) return false;
szName.

Anyway, you'll learn more of your mistakes if you actually find the solution yourself.
 
Back