Trinitycore: Create two characters with the same name

Created on 17 Mar 2018  路  15Comments  路  Source: TrinityCore/TrinityCore

Description:
When creating a character, you can duplicate it. there will be 2 players with the same name.

Current behaviour:
When creating a character, repeatedly press enter and click "Accept" simultaneously, you will get disconnected, log back and see 2 players created with the same name. Try a few times, seem to be quite easy to reproduce.
Each will have it's own GUID, but same name.

wowscrnshot_031718_015424

Branch(es): 3.3.5

TC rev. hash/commit: 282886984415

Branch-3.3.5a Comp-Core Comp-Database Sub-Database Sub-Player

Most helpful comment

async stronk?

All 15 comments

Confirm, and I can not delete these two characters until restart world server.

Nice hahaha

This is an old issue, introduced before July 2017

async stronk?

Why so much bug and crashs has been raised :laughing:

all changed back on TDB62 OR TDB63 :roll_eyes:

Why so much bug and crashs has been raised 馃槅
all changed back on TDB62 OR TDB63 馃檮

This is an old issue, introduced before July 2017

confirm

Not quite sure how, but seems to be some similar issues with faction change, character customize, and so on.

Can be related with #20106 too??

no

The name field in the characters table in the character database isn't required to be unique. While it's marked as a KEY, it's just an index so it doesn't require them to be unique. Dropping the existing index and recreating it as unique then making the field unique in the creation SQL should fix it or at least make it so the second add will fail.

This fixes it for me:

DROP INDEX `idx_name` on `characters`;
CREATE UNIQUE INDEX `idx_name` ON `characters` (name);

Thats a partial solution - proper one should also inform the client that name already exists

When it's legitimate it's already handled in CharacterHandler and it will return a name already in use. The problem is you can flood the server with CMSG_CHAR_CREATE by rapidly clicking Accept and hitting enter. You can get the client to send a second CMSG_CHAR_CREATE packet before the server responds to the first which I think is creating the duplicate.

C->S: [Player: Account: 1] [CMSG_CHAR_CREATE 0x0036 (54)]
C->S: [Player: Account: 1] [CMSG_CHAR_CREATE 0x0036 (54)]
S->C: [Player: Account: 1] [SMSG_CHAR_CREATE 0x003A (58)]
S->C: [Player: Account: 1] [SMSG_CHAR_CREATE 0x003A (58)]

I think a more complete solution would be to ignore any incoming CMSG_CHAR_CREATE packets from that account until after the server responds. For the time being, maybe enforcing on the database as a backup line of defence would be a good idea?

Who can fix this problem?

Yes that's right
@Shocker
or
@Shauren
or
@irgc
:smile:

Fixed By @Shauren
WINER
:cupid:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DDuarte picture DDuarte  路  3Comments

Rushor picture Rushor  路  3Comments

funjoker picture funjoker  路  3Comments

Rochet2 picture Rochet2  路  3Comments

Tatara902 picture Tatara902  路  3Comments