Y-Less / sscanf

SA:MP sscanf plugin originally made by @Y-Less
Other
119 stars 49 forks source link

OMP B11| Version: 2.13.4.0 | It crashes my server while having crashdetect plugin #52

Closed eksqtr closed 1 year ago

eksqtr commented 1 year ago

OMP Build11

When this error appears it crashes my server [22:57:22] [Info] sscanf warning (./includes/discord/discord_api.pwn:32): "Unclosed default value." [22:57:22] [Info] sscanf error (./includes/discord/discord_api.pwn:32): "String/array must include a length, please add a destination size."

Code

if (sscanf(content, "s[20]S()[200]", command, params)) { // This line return 0; }

Whole Code:

` public DCC_OnMessageCreate(const DCC_Message: message) {

new
    DCC_User: author,
    DCC_Channel: channel,
    DCC_Message: messageid,
    bool: is_bot = false,
    content[200 + MAX_CMD_NAME + 2],
    command[MAX_CMD_NAME],
    params[200],
    discord[MAX_CMD_LEN] = "discord_"
;

DCC_GetMessageChannel(message, channel);
DCC_GetMessageAuthor(message, author);
messageid = message;

DCC_IsUserBot(author, is_bot);
DCC_GetMessageContent(message, content);
if (is_bot || content[0] != CMD_PREFIX) { // Skip if the message author is a bot or is not a command
        return 0;
}

if (sscanf(content, "s[20]S()[200]", command, params)) {
        return 0;
}

for (new i = strlen(command) - 1; i != 0; i --) {
    command[i] |= 0x20; // lower case using bitwise OR operator
}

strcat(discord, command[1]);

if (isnull(params)) {
    params = "\1";
}

OnDiscordCommandPerformed(channel, author, bool: CallLocalFunction(discord, "iiis", _: channel, _: author, _: messageid, params));  
return 1;

}`

I'm using discord connector plugin with this.