View Single Post
Argus
Junior Member
Join Date: Oct 2007
Location: Russia
Old 10-01-2011 , 11:34   Re: Name Checker 1.5
Reply With Quote #46

I have found bug in this plugins.

in badnames.txt:
Quote:
cs.superserver.com
.com
url cs.superserver.com is fictitious.

I try name "cs.superserver.com" - plugin kicks me. thats ok.
I try name "123 cs.superserver.com" - plugin pass me! wtf??

so I started to check sourcecode.

I wrote in function "CheckName" some output code to check what is happened with nick:
Quote:
PrintToServer("1. &s", name);
...
PrintToServer("2. &s", name);
...
and inside the "badnames" block this output:
Quote:
PrintToServer("&s | %s", name, name2);
and then I connect to server with name "123 cs.superserver.com" server console prints:

Quote:
1. 123 cs.superserver.com
2. 123 cs.superserver.com
...
6. 123 cs.superserver.com
7. 123 cs.superserver.c

123 cs.superserver.c | cs.superserver.com
123 cs.superserver.c | .com
this means:
plugins lost 2 char of name between PrintToServer("6. &s", name); and PrintToServer("7. &s", name);
and inside the "badnames" block in trying to compare "123 cs.superserver.c" and "cs.superserver.com" - but thats names is different! so no kick.
the block between PrintToServer("6. &s", name); and PrintToServer("7. &s", name); is:

Quote:
name[iCopySize] = '\0';
for(new i=0;i<g_iMaxPlayers;i++) {
strcopy(name2,iCopySize,g_sNames[i][0]);
TrimString(name2);
if ((i!=client) && (strlen(name2)>3) && (StringDiff(name,name2) < iCopyDiff))
return 8;
}
error in this code.

so I just swap this "error block code" and "badnames block" in sourcecod and after compiling:

Quote:
1. 123 cs.superserver.com
2. 123 cs.superserver.com
...
6. 123 cs.superserver.com
7. 123 cs.superserver.com

123 cs.superserver.com | cs.superserver.com (here server kicks me. yeahbaby!!!)
if try name "123 cs.supe123rserver.com":

Quote:
1. 123 cs.supe123rserver.com
...

123 cs.supe123rserver.com | cs.superserver.com (nothing happened)
123 cs.supe123rserver.com | .com (here server kicks me.)
in attach fixed plugin.
Attached Files
File Type: sp Get Plugin or Get Source (namechecker.sp - 663 views - 15.9 KB)

Last edited by Argus; 10-01-2011 at 11:36.
Argus is offline