String Buffer Overflow -
Abreezy - 23.12.2011
pawn Код:
if(mysql_fetch_row(szQuery2)) { sscanf(str, "e<p<|>s[24]s[64]s[16]fffdddddd>", User[playerid]); }
[00:40:49] sscanf warning: String buffer overflow.
Shows up in the command processor. Whys that? I can't find the issue, and i believe this is why loading isn't working for me. I use the plugin, sscanf2.
Re: String Buffer Overflow -
Rokzlive - 23.12.2011
"e<p<|>s[24]s[64]s[16]fffdddddd" When your putting in all those, you can tend to make a huge query (string) and servers dont exactly like that. Try to make it smaller.
Re: String Buffer Overflow -
Calgon - 23.12.2011
Your string's buffer is overflown by the increased amount of data you're trying to load in to one of the strings. Increase the size of the string that is being problematic, which is either the 24, 64 or 16 cell sized strings.
Quote:
Originally Posted by Rokzlive
"e<p<|>s[24]s[64]s[16]fffdddddd" When your putting in all those, you can tend to make a huge query (string) and servers dont exactly like that. Try to make it smaller.
|
Ignore this, sscanf hasn't ever raged at me for unloading massive string values before from MySQL, and I've dealt with 2000+ characters before IIRC.
Re: String Buffer Overflow -
[Diablo] - 23.12.2011
not sure if this has anything to do with your problem, but i always use delimiter before enum.
pawn Код:
if(mysql_fetch_row(szQuery2)) { sscanf(str, "p<|>e<s[24]s[64]s[16]fffdddddd>", User[playerid]); }
Re: String Buffer Overflow -
Abreezy - 23.12.2011
Quote:
Originally Posted by Calgon
Your string's buffer is overflown by the increased amount of data you're trying to load in to one of the strings. Increase the size of the string that is being problematic, which is either the 24, 64 or 16 cell sized strings.
Ignore this, this poster has no idea what he's talking about.
|
Those string values are correct, Username = 24, Password = 64 as it is encrypted, and 16 = the players IP.
Although, as I think about it, do i really need to include those in the sscanf loading? I was told if I left those out, I couldn't use : "e<p<|>".
Re: String Buffer Overflow -
Calgon - 23.12.2011
Show us more code around the function?
Re: String Buffer Overflow -
Abreezy - 23.12.2011
Alright, here's the enum:
pawn Код:
Username[24],
Password[64],
IP[16],
Float:pX,
Float:pY,
Float:pZ,
Interior,
VWorld,
Level,
Money,
Skin,
Gender,
Then the full sscanf code for login
pawn Код:
if(mysql_fetch_row(szQuery2)) { sscanf(str, "e<p<|>s[28]s[80]s[20]fffdddddd>", User[playerid]); }
format(szQuery2, sizeof(szQuery2), "UPDATE "SQL_ACCOUNT_TABLE" SET IP = '%s' WHERE Username = '%s'", pIP(playerid), pName(playerid));
mysql_query(szQuery2);
Anything else you need to see, feel free to request.
Re: String Buffer Overflow -
Calgon - 23.12.2011
Where is 'str' defined and how do you allocate a value to it?
Re: String Buffer Overflow -
Abreezy - 23.12.2011
Quote:
Originally Posted by Calgon
Where is 'str' defined and how do you allocate a value to it?
|
I made them global variables, if I'm correct with the name, so I have this defined up top:
pawn Код:
new
str[1024],
szQuery[1024],
szQuery2[1024];
Re: String Buffer Overflow -
Babul - 23.12.2011
can it be the
in your sscan line? you declared the strings smaller in the enum (s[24]s[64]s[16]), but try to write more data into them...