1818
1919
2020
21- #define PLUGIN_VERSION " 2.25 "
21+ #define PLUGIN_VERSION " 2.26 "
2222
2323/* =======================================================================================
2424 Plugin Info:
3232========================================================================================
3333 Change Log:
3434
35+ 2.26 (21-May-2025)
36+ - Added native "SprayExploitFixer_LogCustom" to log custom messages. Requested by ".Rushaway".
37+ - Added RegPluginLibrary "spray_exploit_fixer".
38+
35392.25 (04-Jan-2025)
3640 - Changes to the recent exploit fix. Thanks to "Madness (null138)" for fixing and reporting.
3741
184188
185189#include <sourcemod>
186190#include <sdktools>
191+ #include <spray_exploit>
187192
188193
189194#define MAX_READ 50
@@ -240,6 +245,10 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
240245 MarkNativeAsOptional (" SBPP_BanPlayer" );
241246 MarkNativeAsOptional (" MABanPlayer" );
242247
248+ RegPluginLibrary (" spray_exploit_fixer" );
249+
250+ CreateNative (" SprayExploitFixer_LogCustom" , Native_LogCustom );
251+
243252 g_iEngine = GetEngineVersion ();
244253 g_bLate = late ;
245254
@@ -318,7 +327,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
318327 static char sTemp [PLATFORM_MAX_PATH ];
319328 GetPlayerJingleFile (client , sTemp , sizeof (sTemp ));
320329
321- Format (cc , sizeof (cc ), " /%c%c /" , sTemp [0 ], sTemp [1 ]);
330+ FormatEx (cc , sizeof (cc ), " /%c%c /" , sTemp [0 ], sTemp [1 ]);
322331 Format (sTemp , sizeof (sTemp ), " %s%s .dat" , g_sDownloads , sTemp );
323332 ReplaceString (sTemp , sizeof (sTemp ), " /cc/" , cc );
324333
@@ -607,7 +616,7 @@ void RecursiveSearchDirs(int client, ArrayList aList, int &count, int &counts, b
607616 pos = FindCharInString (sPath , ' /' , true );
608617 if ( pos != - 1 ) sPath [pos ] = 0 ;
609618
610- Format (sNew , sizeof (sNew ), " %s /%s /%s " , g_sMoveFiles , PATH_BACKUP , sPath [pos + 1 ]);
619+ FormatEx (sNew , sizeof (sNew ), " %s /%s /%s " , g_sMoveFiles , PATH_BACKUP , sPath [pos + 1 ]);
611620 if ( FileExists (sNew , true ) ) DeleteFile (sNew , true );
612621
613622 if ( pos != - 1 ) sPath [pos ] = ' /' ;
@@ -761,7 +770,7 @@ Action PlayerDecal(const char[] te_name, const int[] Players, int numClients, fl
761770 ReplaceString (g_sFilename , sizeof (g_sFilename ), g_sDownloads , " " );
762771 ReplaceString (g_sFilename , sizeof (g_sFilename ), " .dat" , " " );
763772
764- Format (cc , sizeof (cc ), " /%c%c /" , g_sFilename [0 ], g_sFilename [1 ]);
773+ FormatEx (cc , sizeof (cc ), " /%c%c /" , g_sFilename [0 ], g_sFilename [1 ]);
765774 Format (g_sFilename , sizeof (g_sFilename ), " %s%s .dat" , g_sDownloads , g_sFilename );
766775 ReplaceString (g_sFilename , sizeof (g_sFilename ), " /cc/" , cc );
767776
@@ -777,9 +786,9 @@ Action PlayerDecal(const char[] te_name, const int[] Players, int numClients, fl
777786 {
778787 static char auth [64 ];
779788 if ( g_sAuth [client ][6 ] == ' I' )
780- Format (auth , sizeof (auth ), " Unverified: %s " , g_sAuthUnverified [client ]);
789+ FormatEx (auth , sizeof (auth ), " Unverified: %s " , g_sAuthUnverified [client ]);
781790 else
782- Format (auth , sizeof (auth ), " %s " , g_sAuth [client ]);
791+ FormatEx (auth , sizeof (auth ), " %s " , g_sAuth [client ]);
783792
784793 if ( FileExists (g_sFilename ) )
785794 {
@@ -942,9 +951,9 @@ public Action OnFileReceive(int client, const char[] sFile)
942951 {
943952 static char auth [64 ];
944953 if ( g_sAuth [client ][6 ] == ' I' )
945- Format (auth , sizeof (auth ), " Unverified: %s " , g_sAuthUnverified [client ]);
954+ FormatEx (auth , sizeof (auth ), " Unverified: %s " , g_sAuthUnverified [client ]);
946955 else
947- Format (auth , sizeof (auth ), " %s " , g_sAuth [client ]);
956+ FormatEx (auth , sizeof (auth ), " %s " , g_sAuth [client ]);
948957
949958 LogCustom (" File received: %s from (%N ) [%s ]" , sFile , client , auth );
950959 }
@@ -1006,9 +1015,9 @@ void FileCheck()
10061015 {
10071016 static char auth [64 ];
10081017 if ( g_sAuth [client ][6 ] == ' I' )
1009- Format (auth , sizeof (auth ), " Unverified: %s " , g_sAuthUnverified [client ]);
1018+ FormatEx (auth , sizeof (auth ), " Unverified: %s " , g_sAuthUnverified [client ]);
10101019 else
1011- Format (auth , sizeof (auth ), " %s " , g_sAuth [client ]);
1020+ FormatEx (auth , sizeof (auth ), " %s " , g_sAuth [client ]);
10121021
10131022 if ( g_hCvarLog .IntValue ) LogCustom (" Invalid spray: %s from (%N ) [%s ]" , g_sFilename , client , auth );
10141023 if ( g_hCvarMsg .IntValue ) PrintToServer (" [Spray Exploit] Invalid spray: %s : %02d (%02X <> %02X ) from (%N ) [%s ]" , g_sFilename , i , iRead [i ], g_iVal [i ], client , auth );
@@ -1048,7 +1057,7 @@ int ValFile(int iRead[sizeof(g_iVal)])
10481057 return - 1 ;
10491058 }
10501059
1051- if ( iRead [16 ] == 80 && iRead [24 ] > 1 )
1060+ if ( iRead [21 ] == 42 && iRead [ 24 ] > 1 || iRead [ 16 ] == 80 && iRead [24 ] > 1 )
10521061 {
10531062 return 24 ;
10541063 }
@@ -1066,13 +1075,13 @@ int ValFile(int iRead[sizeof(g_iVal)])
10661075 case 8 : read = iRead [i ] <= 5 ;
10671076 case 16 , 18 :
10681077 {
1069- Format (bytes , sizeof (bytes ), " %02X%02X " , iRead [i + 1 ], iRead [i ]);
1078+ FormatEx (bytes , sizeof (bytes ), " %02X%02X " , iRead [i + 1 ], iRead [i ]);
10701079 n = HexToDec (bytes );
10711080 if ( n < 0 || n > 8192 ) read = false ;
10721081 }
10731082 case 20 :
10741083 {
1075- Format (bytes , sizeof (bytes ), " %02X%02X%02X%02X " , iRead [i + 3 ], iRead [i + 2 ], iRead [i + 1 ], iRead [i ]);
1084+ FormatEx (bytes , sizeof (bytes ), " %02X%02X%02X%02X " , iRead [i + 3 ], iRead [i + 2 ], iRead [i + 1 ], iRead [i ]);
10761085 n = HexToDec (bytes );
10771086 if ( n & (0x8000 | 0x10000 | 0x800000 ) ) read = false ;
10781087 }
@@ -1132,3 +1141,11 @@ void LogCustom(const char[] format, any ...)
11321141 FlushFile (file );
11331142 delete file ;
11341143}
1144+
1145+ public int Native_LogCustom (Handle plugin , int numParams )
1146+ {
1147+ char sBuffer [2048 ];
1148+ FormatNativeString (0 , 1 , 2 , sizeof (sBuffer ), _ , sBuffer );
1149+ LogCustom (sBuffer );
1150+ return 1 ;
1151+ }
0 commit comments