sscanf(String,"s[24] s[200] s[24] s[10] s[8]",PlayerBannedName[playerid],PlayerBannedReason[playerid],PlayerBannedAdministrator[playerid],PlayerBannedDate[playerid],PlayerBannedTime[playerid]);
new PlayerBannedName[MAXIMAL_PLAYERS][24]; new PlayerBannedReason[MAXIMAL_PLAYERS][200]; new PlayerBannedAdministrator[MAXIMAL_PLAYERS][24]; new PlayerBannedDate[MAXIMAL_PLAYERS][10]; new PlayerBannedTime[MAXIMAL_PLAYERS][8];
[02:17:42] sscanf warning: String buffer overflow. [02:17:42] sscanf warning: String buffer overflow. |
public OnPlayerConnect(playerid) { new String[200]; GetPlayerName(playerid,PlayerName[playerid],24); GetPlayerIp(playerid,PlayerIp[playerid],16); PlayerRconAdministrator[playerid] = 0; PlayerRconPasswordAttempt[playerid] = 0; format(String,200,"%s%s.ini",FOLDER_BANS,PlayerIp[playerid]); if(fexist(String)) { PlayerBanned[playerid] = 1; new File:File = fopen(String,io_read); fread(File,String); sscanf(String,"s[24] s[200] s[24] s[10] s[8]",PlayerBannedName[playerid],PlayerBannedReason[playerid],PlayerBannedAdministrator[playerid],PlayerBannedDate[playerid],PlayerBannedTime[playerid]); SendClientMessage(playerid,0,""WHITE">> Twoje ip zostało zbanowane."); format(String,200,""WHITE">> Nick na ktуrym zostałeś zbanowany to "DARK_WHITE"%s"WHITE".",PlayerBannedName[playerid]); SendClientMessage(playerid,0,String); format(String,200,""WHITE">> Powуd, za ktуry zostałeś zbanowany to "DARK_WHITE"%s"WHITE".",PlayerBannedReason[playerid]); SendClientMessage(playerid,0,String); format(String,200,""WHITE">> Administrator ktуry cię zbanował to "DARK_WHITE"%s"WHITE".",PlayerBannedAdministrator[playerid]); SendClientMessage(playerid,0,String); format(String,200,""WHITE">> Zostałeś zbanowany "DARK_WHITE"%s "WHITE"o godzinie "DARK_WHITE"%s"WHITE".",PlayerBannedDate[playerid],PlayerBannedTime[playerid]); SendClientMessage(playerid,0,String); Kick(playerid); } return 1; }
sscanf warning: String buffer overflow. This error comes up when people try and put too much data in to a string. For example: pawn Code: new str[10]; sscanf("Hello there, how are you?", "s[10]", str); That code will try and put the string "Hello there, how are you?" in to the variable called "str". However, "str" is only 10 cells big and can thus only hold the string "Hello ther" (with a NULL terminator). In this case, the rest of the data is ignored - which could be good or bad: pawn Code: new str[10], num; sscanf("Hello there you|42", "p<|>s[10]i", str, num); In this case "num" is still correctly set to "42", but the warning is given for lost data ("e you"). Currently there is nothing you can do about this from a programming side (you can't even detect it - that is a problem I intend to address), as long as you specify how much data a user should enter this will simply discard the excess, or make the destination variable large enough to handle all cases. |
sscanf(String,"s[24] s[200] s[24] s[10] s[8]
new String[200];
new String[266];