Raze reported on Discord that his name yesterday showed up wrong for other players: it had strange characters appended to it. To him, the name looked normal.
I confirmed different wonky names were seen on different servers using CHEF:
Somehow, it looks like some buggy code moves the NUL byte Sauer uses to find the string's end when sending the player's name on connect. (Note how there is only one weird name per server.)
I'm not 100% sure how that could explain him seeing the name rendered correctly, since the UI field should show whatever is stored in player1->name... maybe you have an idea? (When I asked Raze, he said he didn't use wc-ng's chat features yesterday when it happened.)
Raze reported on Discord that his name yesterday showed up wrong for other players: it had strange characters appended to it. To him, the name looked normal.
I confirmed different wonky names were seen on different servers using CHEF:
I looked into the wc-ng code a bit, especially all the places where
player1->name
is accessed, and found this line, which runs via client::switchname() and mod::chat::updatename(): https://github.com/tpoechtrager/wc-ng/blob/d5ba6bd32feb00a83a1f22ee37dab7a42ea0be3f/src/mod/chat.cpp#L586The operator overloading looks fine to me (a C++ noob), in that it copies the string over, however, there is some dense logic when setting the length argument that's passed to memcpy() later. Could you check if you can see a bug here? https://github.com/tpoechtrager/wc-ng/blob/d5ba6bd32feb00a83a1f22ee37dab7a42ea0be3f/src/mod/strtool.h#L85
Somehow, it looks like some buggy code moves the NUL byte Sauer uses to find the string's end when sending the player's name on connect. (Note how there is only one weird name per server.)
I'm not 100% sure how that could explain him seeing the name rendered correctly, since the UI field should show whatever is stored in
player1->name
... maybe you have an idea? (When I asked Raze, he said he didn't use wc-ng's chat features yesterday when it happened.)