Raised This Month: $51 Target: $400
 12% 

False positives due to comparing float values with StrEqual


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 01-23-2016 , 07:39  
Reply With Quote #1

Hello!
I have a Freak Fortress 2 server and this is happening:
HTML Code:
L 01/23/2016 - 14:18:05: [smac_cvars.smx | 0.8.6.0] skrillexxx20 (ID: STEAM_0:1:96489148 | IP: 84.0.175.186) was banned for failing checks on convar "host_timescale". result "Okay" | CompType: "replicated" | cvarValue "1.00000000" | value: "1.0" | value2: "1.0"
    Map: mvm_coaltown | Origin: 716 1382 496 | Angles: 33 148 0 | Weapon: tf_weapon_shotgun_soldier | Team: 2 | Latency: 105ms
The detection is for host_timescale-a cvar that Freak Fortress 2 changes during some boss rages. The most interesting part is that 1.0 is not equal to 1.00000000! There are two reasons why this os happening:
1) Due to the FileExist check, it takes too long for Freak Fortress 2 to check if all boss files are on the harddrive. For this reason, the watchdog timer in Sourcemod stops the execution of the code, which prevent the execution of the code which removes that cvar from the list of SMAC.
2) In the code, I noticed that if the cvar is replicated flag, the client value of the cvar is tested if it's equat to the server value using StrEqual. For example:
PHP Code:
new String:cvar1="1.0000000"
new String:cvar2="1.0"

new bool:Equal1=(StringToFlat(cvar1)==StringToFlat(cvar2));
new 
bool:Equal2=(StrEqual(cvar1cvar2)); 
Equal1 will return true, but Equal2 will return false. Comparing float values with StrEqual will result in false positives. The float values strings first have to be converted in float values and then compared!
The exact part of the code is located in smac_cvars.sp file on line 467-473.

No one want to comment for this issue? 30 players were banned because of this issue on my own server!

Last edited by Naydef; 02-13-2016 at 13:11. Reason: Naydef is better than psychonic!
Naydef is offline
Reply



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 16:52.


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