View Single Post
emsit
Member
Join Date: Apr 2015
Old 02-24-2018 , 16:50   Re: name[MAX_NAME_LENGTH]
Reply With Quote #3

But I think sourcemod works with a longer user name than 32 bytes. (I must test it.)

In any case, the string returned from GetClientName in conjunction with MAX_NAME_LENGTH returns the corrupted string.

Here is an example of a user with the name "████████████████████" (strlen = 60)

PHP Code:
char sName[MAX_NAME_LENGTH];
GetClientName(clientsNamesizeof(sName));

char escaped_name[MAX_NAME_LENGTH 2];
hDatabase.Escape(nameescaped_namesizeof(escaped_name));
FormatEx(querysizeof(query), "INSERT INTO test (server, steamid, name) VALUES ('%s', '%s', '%s');"ServerIPsteamidescaped_name); 
Missing apostrophe at the end!
Code:
L 02/22/2018 - 09:00:58: Query: INSERT INTO test (server, steamid, name) VALUES ('5.196.99.41:27015', '[U:1:XXXXXXXX]', '██████████?);
L 02/22/2018 - 09:00:58: Query failed! Incorrect string value: '\xE2' for column 'name' at row 1
__________________


Last edited by emsit; 02-26-2018 at 02:44.
emsit is offline