Server Crashing,need help.Urgent.
#1

So i run the crashdetect plugin and it outputs

pawn Код:
[19:21:29] [debug] #24 0804b491 in ?? () from ./samp03svr
[19:21:29] [debug] #23 f7475ce6 in __libc_start_main () from /lib/libc.so.6
[19:21:29] [debug] #22 080a8fb3 in ?? () from ./samp03svr
[19:21:29] [debug] #21 080ad652 in ?? () from ./samp03svr
[19:21:29] [debug] #20 080ad426 in ?? () from ./samp03svr
[19:21:29] [debug] #19 0807d2b0 in ?? () from ./samp03svr
[19:21:29] [debug] #18 080734a2 in ?? () from ./samp03svr
[19:21:29] [debug] #17 080733b1 in ?? () from ./samp03svr
[19:21:29] [debug] #16 080b117a in ?? () from ./samp03svr
[19:21:29] [debug] #15 080a5e9f in ?? () from ./samp03svr
[19:21:29] [debug] #14 f7393699 in ?? () from plugins/crashdetect.so
[19:21:29] [debug] #13 f738b622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so
[19:21:29] [debug] #12 f739a926 in amx_Exec () from plugins/crashdetect.so
[19:21:29] [debug] #11 f739365e in ?? () from plugins/crashdetect.so
[19:21:29] [debug] #10 f738b5a2 in _ZN11crashdetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[19:21:29] [debug] #9 080954a4 in ?? () from ./samp03svr
[19:21:29] [debug] #8 080d7669 in ?? () from ./samp03svr
[19:21:29] [debug] #7 080abe41 in ?? () from ./samp03svr
[19:21:29] [debug] #6 f74c25bc in vsprintf () from /lib/libc.so.6
[19:21:29] [debug] #5 f74a335e in _IO_vfprintf () from /lib/libc.so.6
[19:21:29] [debug] #4 f7752410 in ?? ()
[19:21:29] [debug] #3 f73953c1 in ?? () from plugins/crashdetect.so
[19:21:29] [debug] #2 f738a963 in _ZN11crashdetect15SystemExceptionEPv () from plugins/crashdetect.so
[19:21:29] [debug] #1 f738c41f in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so
[19:21:29] [debug] #0 f7395f41 in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[19:21:29] [debug] System backtrace:
[19:21:29] [debug] #1 0016d670 in public OnDialogResponse () from nrrp.amx
[19:21:29] [debug] #0 native SendClientMessage () [080d75c0] from samp03svr
[19:21:29] [debug] AMX backtrace:
[19:21:29] [debug] Server crashed while executing nrrp.amx
Here's OnDialogResponse:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new vehid = GetPlayerVehicleID(playerid);
    new vehmd = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(dialogid == 0) // Tutorial
    {
        if(response)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen to see the tutorial, please wait for it to load.");
            SetTimerEx("Tut1", 2000, false, "i", playerid);
        }
        else
        {
            PlayerInfo[playerid][pTutorial] = 1;
            SpawnChar(playerid);
            TogglePlayerControllable(playerid, 1);
            SetPlayerVirtualWorld(playerid, 0);
            SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen not to see the tutorial, welcome to International Roleplay.");
            SendClientMessage(playerid, COLOR_VIP, "SERVER: You have been automatically refunded $75000 and 15 Days of Silver VIP.");
            // Starter Package
            GiveZaiatMoney(playerid, 75000);
            PlayerInfo[playerid][pNew] = 1;
            PlayerInfo[playerid][pModel] = NEWBSKIN;
            SetPlayerSkin(playerid, NEWBSKIN);
            PlayerInfo[playerid][pFightStyle] = FIGHT_STYLE_NORMAL;
            //vip refund
            new Year, Month, Day;
            new Hour, Minute, Second;
            gettime(Hour, Minute, Second);
            getdate(Year, Month, Day);
            if(Day+15 >= 30)
            {
                new ActualDay;
                Month ++;
                ActualDay = 15 - (30-Day);
                PlayerInfo[playerid][pVIPDay] = ActualDay;
                PlayerInfo[playerid][pVIPMonth] = Month;
                PlayerInfo[playerid][pVIPHour] = Hour;
            }
            else
            {
                PlayerInfo[playerid][pVIPDay] = Day+15;
                PlayerInfo[playerid][pVIPMonth] = Month;
                PlayerInfo[playerid][pVIPHour] = Hour;
            }
            // Done
            PlayerInfo[playerid][pVIP] = 2;
        }
    }
    else if(dialogid == 1) // Register
    {
        if(response)
        {
            if(strlen(inputtext) < 4)
            {
             SendClientMessage(playerid, COLOR_GREY, "Password can't be shorter than 4 characters.");
             ShowDialog(playerid, 1);
             return 1;
            }
            if(strlen(inputtext) > 256)
            {
                SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters.");
                ShowDialog(playerid, 1);
                return 1;
            }
            new file[64], IP[16], string[128], password[256];
            format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
            if(!dini_Exists(file))
            {
                GetPlayerIp(playerid, IP, sizeof(IP));
                WP_Hash(password, sizeof(password), inputtext);
                PlayerInfo[playerid][pLevel] = 1;
                new INI:filez = INI_Open(Path(playerid));
                INI_WriteString(filez,"IP", IP);
                INI_WriteInt(filez,"Level", PlayerInfo[playerid][pLevel]);
                INI_Close(filez);
                dini_Set(file, "Password", password);
                format(string, sizeof(string), "SERVER: {FFFFFF}You have successfully registered on {FF6347}International Roleplay{FFFFFF}. (Password: %s)", inputtext);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                ShowDialog(playerid, 2);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen to quit the server.");
            Kick(playerid);
        }
    }
    else if(dialogid == 2) // Login
    {
        if(response)
        {
            new file[64], password[256], IP[16], password2[256];
            format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
            WP_Hash(password2, sizeof(password2), inputtext);
            format(password, sizeof(password), "%s", dini_Get(file, "Password"));
            if(strlen(inputtext) < 4)
            {
             SendClientMessage(playerid, COLOR_GREY, "Password can't be shorter than 4 characters.");
             ShowDialog(playerid, 2);
             return 1;
            }
            if(strlen(inputtext) > 256)
            {
                SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters.");
                ShowDialog(playerid, 2);
                return 1;
            }
            if(strcmp(password, inputtext,true) && strcmp(password, password2, true))
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Invalid password.");
                ShowDialog(playerid, 2);
                return 1;
            }
            if(dini_Int(file, "AdminAccount") == 1)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You can't login directly from an admin account.");
                Kick(playerid);
                return 1;
            }
            else if(sscanf(inputtext, "s[128]", inputtext))
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You must enter a password to procceed.");
                ShowDialog(playerid, 2);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                SendClientMessage(playerid, COLOR_LIME, "");
                GetPlayerIp(playerid, IP, sizeof(IP));
                new INI:filez = INI_Open(Path(playerid));
                INI_WriteString(filez,"IP", IP);
                INI_Close(filez);
                LoadChar(playerid);
                SpawnPlayer(playerid);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen to quit the server.");
            Kick(playerid);
        }
    }
    else if(dialogid == 3) // Male or Female
    {
        if(response)
        {
            if(VIP[playerid])
            {
                switch(listitem)
                {
                    case 0:
                    {
                        PlayerInfo[playerid][pGender] = 1;
                        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to male.");
                    }
                    case 1:
                    {
                        PlayerInfo[playerid][pGender] = 2;
                        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to female.");
                    }
                }
                VIP[playerid] = 0;
            }
            else
            {
                switch(listitem)
                {
                    case 0:
                    {
                        PlayerInfo[playerid][pGender] = 1;
                        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to male, pick their age from the next dialog.");
                    }
                    case 1:
                    {
                        PlayerInfo[playerid][pGender] = 2;
                        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to female, pick her age from the next dialog.");
                    }
                }
                ShowDialog(playerid, 4);
            }
        }
        else
        {
            if(!VIP[playerid])
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You MUST choose a gender for your character.");
                ShowDialog(playerid, 3);
            }
            VIP[playerid] = 0;
        }
    }
    else if(dialogid == 4)
    {
        if(response)
        {
            new age = strval(inputtext);
            if(VIP[playerid])
            {
                if(age < 14 || age > 80)
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Age must be beteen 14 and 80.");
                    ShowDialog(playerid, 4);
                }
                else
                {
                    new string[128];
                    PlayerInfo[playerid][pAge] = strval(inputtext);
                    format(string, sizeof(string), "SERVER: {FFFFFF}You've set your character's age to %d", PlayerInfo[playerid][pAge]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                }
                VIP[playerid] = 0;
            }
            else
            {
                if(age < 14 || age > 80)
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Age must be beteen 14 and 80.");
                    ShowDialog(playerid, 4);
                }
                else
                {
                    new string[128];
                    PlayerInfo[playerid][pAge] = strval(inputtext);
                    format(string, sizeof(string), "SERVER: {FFFFFF}You've set your character's age to %d", PlayerInfo[playerid][pAge]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    PlayerInfo[playerid][pLoggedIn] = 1;
                    PlayerInfo[playerid][pSpawn] = 1;
                    SpawnPlayer(playerid);
                }
            }
        }
        else
        {
            if(!VIP[playerid])
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You MUST pick an age for your character.");
                ShowDialog(playerid, 4);
            }
            VIP[playerid] = 0;
        }
    }
I'm guessing it's from that part of the dialogs because it happens when a player connects and the login screen is shown.Somebody really hates us today and keeps abusing this bug to crash the server.I don't understand what may cause the problem.Can anyone help out?
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=249226
use this. nativechecker.
Reply
#3

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
Actually sorry for repost but i found out that the server can be crashed when an account is registered using the string exploit a.k.a registering a password that starts with %s and eventually some random letters after it like maybe %sagsahahasdha.So my question is how to fix that string exploit?Or how to check if the password string contains or starts with %s.
Reply
#4

That's a known vulnerability regarding dialog inputs, but I assume it is not something that should be disabled at the SA-MP core level, because there are other things to do with the input rather than format it, so the SA-MP developers cannot possibly restrict percent signs.

What you need to do is get rid of these using a loop, for example:
pawn Код:
for(new i = 0, j = strlen(inputtext); i != j; i++)
{
    if(inputtext[i] == '%')
        inputtext[i] = ' ';
}
Reply
#5

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
Quote:
Originally Posted by AndreT
Посмотреть сообщение
That's a known vulnerability regarding dialog inputs, but I assume it is not something that should be disabled at the SA-MP core level, because there are other things to do with the input rather than format it, so the SA-MP developers cannot possibly restrict percent signs.

What you need to do is get rid of these using a loop, for example:
pawn Код:
for(new i = 0, j = strlen(inputtext); i != j; i++)
{
    if(inputtext[i] == '%')
        inputtext[i] = ' ';
}
Sorry for re-repost i just wanna thank everyone for being awesome
I just fixed it with:

pawn Код:
if(strfind(inputtext, "%") != -1) return SendClientMessage(playerid, COLOR_GREY, "Go crash another server faggot/bitch.");
Reply
#6

Yeah, that's one way to do it

By the way, to get more precise results from the crashdetect plugin, compile your scripts with the optimization 0 (-O0) and debug 3 (-d3) flags! It will help you the next time!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)