sscanf: String buffer overflow
#1

Well my command is not working right I am sure I am missing something really basic but I just cant see what.

Quote:

{
new PID, reason[35], pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
if(sscanf(params, "us", PID, reason)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /PM [playerid/partofname] [message]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected!");
else
{
new Str[256];
GetPlayerName(PID, pName, sizeof(pName));
GetPlayerName(playerid, Sender, sizeof(Sender));
format(Str, sizeof(Str), "(( PM From: %s(%d): %s ))", Sender, playerid, reason);
SendClientMessage(PID, 0xF6C861AA, Str);
format(Str, sizeof(Str), "(( PM Sent To: %s(%d): %s ))", pName, PID, reason);
SendClientMessage(playerid, 0xF6C861AA, Str);
}
return 1;
}

What is wrong with this?
It says in the server log:

[07:59:41] sscanf warning: Strings without a length are deprecated, please add a destination size.
[07:59:41] sscanf warning: String buffer overflow.
Reply
#2

How do I make it know that?
Reply
#3

Thanks, problem solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)