CMD:ban(playerid, params[]) { new banid, length, reason[STR_SIZE]; if(mData[playerid][Logged] == true && pData[playerid][Logged] == true && mData[playerid][aLevel] >= 1) { if(sscanf(params, "iiS()["#STR_SIZE"]", banid, length, reason)) return SCM(playerid, GREY, "[Usage]: /ban [playerid] [length] [reason]"); else { if(banid != INVALID_PLAYER_ID) { if(mData[banid][Logged] == true && pData[banid][Logged] == true) { if(!isnull(reason)) { format(str, sizeof(str), "%s has been banned by %s [Reason: %s]", PlayerName(banid), PlayerName(playerid), reason); } else { format(str, sizeof(str), "%s has been banned by %s", PlayerName(banid), PlayerName(playerid)); } SGM(RED, str); MySQL::format(query, "INSERT INTO bandata (ID, Username, IP, Author, Date, Type, Length, Reason) VALUES ('%i', '%s', '%s', '%s', '%s', 0, '%i', '%e')", mData[banid][ID], mData[banid][Username], mData[banid][IP], mData[playerid][Username], Unix(1), length, reason); MySQL::slowQuery(query, false); Kick(banid); } else { return SCM(playerid, GREY, PLAYERNOTLOGGEDIN); } } else { return SCM(playerid, GREY, INVALIDPLAYER); } } } else { return SCM(playerid, GREY, CMDNOTALLOWED); } return 1; }
mData[banid][Username]
How do you get the IP? It's stored ?
I think the problem can from here : PHP код:
|
enum Master_Data { ID, Username[MAX_PLAYER_NAME], IP[16], aLevel, bool:Tutorial, Slot1[128], Slot2[128], Slot3[128], bool:Registered, bool:Logged }
It smells like buffer overflow, but I can't quite place my finger on it. You may want to check if mData[banid][Username] is terminated by a null character.
|