Raised This Month: $ Target: $400
 0% 

name[MAX_NAME_LENGTH]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode