sscanf warning: string buffer overflow
#7

Follow this format:

PHP код:
CMD:seteventinfo(playeridparams[])
{
    if(!
IsAllowed(playerid3)) return NoAuth(playerid); 
    if(
isnull(params))
    {
        
SendClientMessage(playeridCOLOR_WHITE"UASGE: /seteventinfo [option]"); 
        
SendClientMessage(playeridCOLOR_GREY"Available Options: Health || Armour || Weapon || Position || Text"); 
        return 
1
    }
    if (!
strcmp(params"health"true6))
    {
        if (
params[6] != ' ' && params[6] != 0)
        {
            
SendClientMessage(playeridCOLOR_WHITE"UASGE: /seteventinfo [option]"); 
            
SendClientMessage(playeridCOLOR_GREY"Available Options: Health || Armour || Weapon || Position || Text"); 
            return 
1
        }
        new 
Float:hp;
        if (
sscanf(params[7], "f"hp))
            return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /seteventinfo health [amount]"); 
        
        
EventHealth hp
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have set the new event health amount."); 
        return 
1;
    }
    
    if (!
strcmp(params"text"true4)) 
    {
        if (
params[4] != ' ' && params[4] != 0)
        {
            
SendClientMessage(playeridCOLOR_WHITE"UASGE: /seteventinfo [option]"); 
            
SendClientMessage(playeridCOLOR_GREY"Available Options: Health || Armour || Weapon || Position || Text"); 
            return 
1
        }
        new 
text[80]; 
        if (
sscanf(params[5], "s[80]"text)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /seteventinfo text [text]"); 
        
format(EventTextsizeof(EventText), "~r~%s"text);
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have set the joining event game text."); 
        return 
1
    }
    
    
/*
    if (!strcmp(params, "[OPTION]", true, LENGTH OF OPTION))
    {
        if (params[LENGTH OF OPTION] != ' ' && params[LENGTH OF OPTION] != 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "UASGE: /seteventinfo [option]"); 
            SendClientMessage(playerid, COLOR_GREY, "Available Options: Health || Armour || Weapon || Position || Text"); 
            return 1; 
        }
        Use params[LENGTH OF OPTION + 1] in sscanf
    }
    */
    
return 1;

Reply


Messages In This Thread
sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 08:40
Re: sscanf warning: string buffer overflow - by ranme15 - 19.11.2016, 09:04
Re: sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 09:19
Re: sscanf warning: string buffer overflow - by ranme15 - 19.11.2016, 09:22
Re: sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 09:26
Re: sscanf warning: string buffer overflow - by SyS - 19.11.2016, 09:32
Re: sscanf warning: string buffer overflow - by Stinged - 19.11.2016, 10:14
Re: sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 19:29
Re: sscanf warning: string buffer overflow - by Dayrion - 20.11.2016, 00:00
Re: sscanf warning: string buffer overflow - by Stinged - 20.11.2016, 05:54

Forum Jump:


Users browsing this thread: 5 Guest(s)