sscanf format broken MySQL -
HighFlyer - 17.02.2012
Hello there,
I am having trouble with an MySQL connection. The console shows following errors and an instant kick or a reconnect follows after an attempt to login.
Код:
[20:31:27] Incoming connection: 127.0.0.1:56888
[20:32:03] Incoming connection: 127.0.0.1:54473
[20:32:03] [join] [SATC]HighFlyer has joined the server (0:127.0.0.1)
[20:32:06] [DEBUG]: Password:
[20:32:06] [DEBUG]: bigstr: SELECT * FROM `satc players` WHERE `name` = ''
[20:32:06] sscanf warning: String buffer overflow.
[20:32:06] [LOGIN]: Playerid (0) ERROR! MYSQL SSCANF FORMAT IS BROKEN !
[20:32:06] [part] [SATC]HighFlyer has left the server (0:2)
[20:32:16] Incoming connection: 127.0.0.1:54474
[20:32:16] [join] [SATC]HighFlyer has joined the server (0:127.0.0.1)
[20:32:18] [DEBUG]: Password:
[20:32:18] [DEBUG]: bigstr: SELECT * FROM `satc players` WHERE `name` = ''
[20:32:18] sscanf warning: String buffer overflow.
[20:32:18] [LOGIN]: Playerid (0) ERROR! MYSQL SSCANF FORMAT IS BROKEN !
[20:32:18] [part] [SATC]HighFlyer has left the server (0:2)
The plugins are loaded, and seem to return no errors. I have used nativechecker to make sure that the GM is compiled with the correct includes, and that all plugins are loaded. libmysql.dll is in the root of the server, with an updated a_mysql.inc include in pawno/includes, as well as mysql.dll in plugins folder. The mysql plugin I'm using is the one from StrickenKid. Excuse me on the lack of memory for it's correct name.
EDIT:// sscanf is latest btw.
I am running the database on localhost port 8080. I am using USBWebServer software to run this, which supports Apache and MySQL. These are the following values to connect with the database, not sure if correct, defined in the gamemode itself.
Код:
// ========================== | - Script Configuration - | ==========================
// Script Configuration - MySQL:
// HOST:
#define SQL_HOST "localhost:8080"
#define SQL_USER "root"
#define SQL_PASS "usbw"
#define SQL_DB "satc"
I tried defining the host using "localhost" and "127.0.0.1:8080" too, but none of these worked. I'd appreciate some help on this one as I'm puzzled.
Thanks and regards,
HighFlyer
Re: sscanf format broken MySQL -
iTorran - 17.02.2012
Can we see the sscanf line from when
Код:
[20:32:18] sscanf warning: String buffer overflow.
[20:32:18] [LOGIN]: Playerid (0) ERROR! MYSQL SSCANF FORMAT IS BROKEN !
happens?
Re: sscanf format broken MySQL -
HighFlyer - 17.02.2012
What exactly do you mean? Thanks for a reply btw.
Re: sscanf format broken MySQL -
iTorran - 17.02.2012
Well judging from the logs, a sscanf code is called around the time you connect. Can we see it?
Looks like
probably
Re: sscanf format broken MySQL -
HighFlyer - 17.02.2012
The error appears upon login. I can't find sscanf(query...), maybe I've accidentaly deleted it :S
Код:
if(dialogid == DIALOG_LOGIN)
{
if(!isnull(inputtext))
{
new EscapeString[3][MAX_PLAYER_NAME], password[30];
GetPlayerIp(playerid, EscapeString[1], MAX_PLAYER_NAME);
GetPlayerName(playerid, pData[playerid][Name], MAX_PLAYER_NAME);
mysql_real_escape_string(EscapeString[1], EscapeString[2]); // used to prevent SQL-Injections.
mysql_real_escape_string(pData[playerid][Name], EscapeString[0]); // used to prevent SQL-Injections.
mysql_debug(1);
format(bigstr, sizeof(bigstr), "SELECT `password` FROM `satc players` WHERE `name` = '%s'", EscapeString[0]);
mysql_query(bigstr);
mysql_store_result();
mysql_fetch_row(password);
printf("[DEBUG]: Password: %s", password);
mysql_free_result();
mysql_debug(0);
format(bigstr, sizeof(bigstr), "SELECT * FROM `satc players` WHERE `name` = '%s'", EscapeString[0]);
mysql_query(bigstr);
mysql_store_result();
if(!strcmp(password, inputtext, true))
{
mysql_fetch_row(bigstr);
printf("[DEBUG]: bigstr: %s", bigstr);
if(!unformat(bigstr,"e<p<|>s[24]s[25]s[16]ddffddddddds[50]ddddd>", pData[playerid]))
{
if(pData[playerid][Banned] == 1)
{
format(str, sizeof(str), "[Auto Kick] %s has been automaticlly kicked. (Reason: Ban Evading)", pData[playerid][Name]);
SendClientMessageToAll(COLOR_ALERT, str);
format(str, sizeof(str), "You have been banned from %s Community...", GLOBAL_SERVER_NAME);
SendClientMessage(playerid, COLOR_ADMIN, str);
format(str, sizeof(str), "Your IP: %s", pData[playerid][IP]);
SendClientMessage(playerid, COLOR_ADMIN, str);
format(str, sizeof(str), "Please visit http://%s for unban appeals and provide this information in the appeal.", GLOBAL_SERVER_WEBSITE);
SendClientMessage(playerid, COLOR_ADMIN, str);
printf("[LOGIN]: Playerid (%d) Is a banned username, auto kicked !", playerid);
Kick(playerid);
return 1;
}
SendClientMessage(playerid, COLOR_SUCCESS, ">> You are now logged in!");
if(pData[playerid][Level] >= 1)
{
format(str, sizeof(str), "SATC Bot: %s %s has joined the server.", aData[pData[playerid][Level]][Name], pData[playerid][Name]);
SendClientMessageToAll(COLOR_GREEN, str);
}
else
{
format(str, sizeof(str), "SATC Bot: Player %s has joined the server.", pData[playerid][Name]);
SendClientMessageToAll(COLOR_GREEN, str);
}
format(str, sizeof(str), "Welcome back %s.", pData[playerid][Name]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[Forums: http://forum.sa-transport.com/ || TeamSpeak 3: 109.104.82.144:9987]");
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Enjoy your stay at San Andreas Transport Clan!");
pData[playerid][Bools] |= PLAYER_LOGGED; // Turning the bit PLAYER_LOGGED ON.
if(pData[playerid][Muted] == 1)
{
pData[playerid][Bools] |= PLAYER_MUTED;
}
if(pData[playerid][Jailed] == 1)
{
pData[playerid][Bools] |= PLAYER_JAILED;
}
SetSpawnInfo(playerid, GetPlayerTeam(playerid), pData[playerid][Skins][0], sData[pData[playerid][Loc]][x], sData[pData[playerid][Loc]][y], sData[pData[playerid][Loc]][z], sData[pData[playerid][Loc]][r], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerInterior(playerid, sData[pData[playerid][Loc]][interior]);
SetCameraBehindPlayer(playerid);
format(bigstr, sizeof(bigstr), "UPDATE `satc players` SET `ip` = '%s' WHERE `name` = '%s'", EscapeString[2], EscapeString[0]);
mysql_query(bigstr);
mysql_free_result();
printf("[LOGIN]: Playerid (%d) Logged in!", playerid);
return 1;
}
printf("[LOGIN]: Playerid (%d) ERROR! MYSQL SSCANF FORMAT IS BROKEN !", playerid); // ERROR msg ~ Check to repary
Kick(playerid);
return 1;
}
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, LOGIN_DIALOG_CAPTION, LOGIN_DIALOG_INFO, "Login", "Cancel");
}
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, LOGIN_DIALOG_CAPTION, LOGIN_DIALOG_INFO, "Login", "Cancel");
}
Re: sscanf format broken MySQL -
HighFlyer - 17.02.2012
Meh double post cause of lag. Sorry.
Re: sscanf format broken MySQL -
iTorran - 17.02.2012
I'm not entirely familiar with what "unformat" is/does, but try this:
pawn Код:
if(!sscanf(bigstr,"e<p<|>s[24]s[25]s[16]ddffddddddds[50]ddddd>", pData[playerid]))
in place of
pawn Код:
if(!unformat(bigstr,"e<p<|>s[24]s[25]s[16]ddffddddddds[50]ddddd>", pData[playerid]))
Re: sscanf format broken MySQL -
HighFlyer - 17.02.2012
Still the same thing.
Re: sscanf format broken MySQL -
gamer931215 - 19.02.2012
Is the format if(!sscanf(bigstr,"e<p<|>s[24]s[25]s[16]ddffddddddds[50]ddddd>", pData[playerid])) correct ? (please give us the enum your trying to inser the data to)