String Buffer Overflow
#1

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.
Reply
#2

"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.
Reply
#3

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.
Reply
#4

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]); }
Reply
#5

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<|>".
Reply
#6

Show us more code around the function?
Reply
#7

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.
Reply
#8

Where is 'str' defined and how do you allocate a value to it?
Reply
#9

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];
Reply
#10

can it be the
Код:
s[28]s[80]s[20]
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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)