ravimohan1991 / Equalizer

A UT2004 mutator to equalize CTF teams
GNU General Public License v3.0
2 stars 0 forks source link

Mangling of information when playername itself contains the delimiter character #2

Closed ravimohan1991 closed 2 years ago

ravimohan1991 commented 2 years ago

Piglet is quite suspicious of the scenario in which the player name itself consists of the database specific characters (for instance ':'). He gave a live example happening on the server for the player name - Sàdly:`-( (UA).

As per Piglet's observation: "The ":" in the player name is being seen by "$infoColumns = explode(':', $info);" (see here) - so it gets split out to a new column. For now I'll work around that by changing the line to "$infoColumns = explode(':', $info, 13);" to limit the number of times it will split."

SUCCESSFULLY_ADDED_ROW ( INSERT INTO `EQPlayerInformation` ( `EQIdentifier` , `Captures` , `Grabs` , `Covers` , `Seals` , `FlagKills` , `TeamKills` , `Points` , `TimePlayedMinutes` , `TimePlayedHours` , `Frags` , `Suicides` , `EQName` ) VALUES ( 'd4e938160821192211113' , '0' , '0' , '0' , '0' , '0' , '0' , '0.00' , '9' , '0' , '0' , '0' , 'mimikatz (RU)' ) )
COULDNT_ADD_NEW_ROW ( INSERT INTO `EQPlayerInformation` ( `EQIdentifier` , `Captures` , `Grabs` , `Covers` , `Seals` , `FlagKills` , `TeamKills` , `Points` , `TimePlayedMinutes` , `TimePlayedHours` , `Frags` , `Suicides` , `EQName` ) VALUES ( 'c30201301819192010517' , '0' , '2' , '0' , '0' , '2' , '0' , '31.00' , '9' , '0' , '17' , '0' , 'Sadly' , '`-( (UA)' ) )
COULDNT_ADD_NEW_ROW ( INSERT INTO `EQPlayerInformation` ( `EQIdentifier` , `Captures` , `Grabs` , `Covers` , `Seals` , `FlagKills` , `TeamKills` , `Points` , `TimePlayedMinutes` , `TimePlayedHours` , `Frags` , `Suicides` , `EQName` ) VALUES ( '4e193c141623211910145' , '0' , '1' , '0' , '0' , '3' , '0' , '27.00' , '9' , '0' , '19' , '1' , 'Kyhado (US)' , '`-( (UA)' ) )
COULDNT_ADD_NEW_ROW ( INSERT INTO `EQPlayerInformation` ( `EQIdentifier` , `Captures` , `Grabs` , `Covers` , `Seals` , `FlagKills` , `TeamKills` , `Points` , `TimePlayedMinutes` , `TimePlayedHours` , `Frags` , `Suicides` , `EQName` ) VALUES ( '9dab8505202121101059' , '2' , '3' , '1' , '0' , '2' , '0' , '61.00' , '9' , '0' , '22' , '1' , '{V][M}Quadro (BE)' , '`-( (UA)' ) )
ravimohan1991 commented 2 years ago

A resolution (Piglet's intuition) might result from using the URLEncode methodology with relevant scope for delimiter characters in player names. Currently the commit 917ebc0 incorporates it in UnrealScript side.

ravimohan1991 commented 2 years ago

After doing some tests, I think, we have fixed the issue in commit 78d948b. We have introduced new explode method in the PHP side which allows any character once it parses that the name field is being dealt with (the cue is essentially delimiter followed by a space like so).

For clarity, I am providing the PHP new explode method

function newExplode(string $delimiter, string $string) 
{
    $stringToExplode = urldecode($string);
    $returnArray = array();
    $bIsTraversingName = False;
    $bIsNameSpaceDelimiter = False;

    $arrString = '';

    for ($i = 0; $i < strlen($stringToExplode); $i++)
    {
        if($stringToExplode[$i] == $delimiter && !$bIsTraversingName)
        {
            if($stringToExplode[$i + 1] == ' ')
            {
                $bIsTraversingName = True;
                $bIsNameSpaceDelimiter = True;
            }

            array_push($returnArray, $arrString);
            $arrString = '';
        }
        else
        {
            if($stringToExplode[$i] == ' ' && $bIsNameSpaceDelimiter)
            {
                $bIsNameSpaceDelimiter = false;
                continue;
            }
            $arrString = $arrString . $stringToExplode[$i];
        }
    }

    array_push($returnArray, $arrString);

    return $returnArray;
}