Bug #396
Reasonless bans are broken
| Status: | Resolved | Start: | 10/04/2008 | |
| Priority: | Immediate | Due date: | ||
| Assigned to: | - | % Done: | 100% |
|
| Category: | Game Plugin | |||
| Target version: | 1.3.1 | |||
Description
All queries to insert bans without a reason fail with the message
Data too long for column 'reason' at row 1
I am going to patch it myself and post the fix here later.
Associated revisions
History
Updated by Recon _ 94 days ago
According to the plugin code, a menu should've been shown to the admin who issued the ban asking them to pick a reason, but I don't think it was because a log message appeared saying that "Verify Insert Query Failed: Data too long for column 'reason' at row 1". That lead me to believe that a reason was never received from the admin.
I think the problem has to do with the decl for the reason string. decl doesn't guarantee what is going to be in the string when you access it and the test that happens later is looking for a \0 at [0] to determine if there is a reason.
In CommandBan
if(args >= 3)
{
GetCmdArg(3, reason, sizeof(reason));
}
should be
if(args >= 3)
{
GetCmdArg(3, reason, sizeof(reason));
}
else
{
reason[0] = '\0';
}
This fix will also need to be applied to the unban, addban and banip commands.
Updated by Erik Minekus 90 days ago
I don't see any problems with this in unban, addban and banip. The reason is already set to \0.
Updated by Recon _ 87 days ago
- File sourcebans.sp added
- File sourcebans.smx added
This should fix it.
The attached plugin also has the admin unban bug fix.
Updated by Erik Minekus 79 days ago
- Status changed from New to Feedback
- Target version set to 1.3.1
- % Done changed from 0 to 100
Fixed in r170.
Updated by Erik Minekus 79 days ago
- Status changed from Feedback to Resolved