Vulnerabilities on receiving null commands
#12

Quote:
Originally Posted by leong124
View Post
Ok I'll try to add those code, thanks.
But I still can't understand why it crashes like that.
I made a test some days ago:
pawn Code:
public OnFilterScriptInit()
{
    test("");
    return 1;
}

forward test(aaa[]);
public test(aaa[])
{
    print(aaa[1]);
    return 1;
}
Nothing goes wrong and "(null)" is output. I know strings have size and out of bounds errors can occur, but I guess the size of the string is unknown(dynamic?) here. Usually CallLocalFunction will crash instantly as SA-MP server is single-threaded. The code is ran in sequence that tasks must be done before going for another. If it doesn't crash at that moment it won't crash suddenly later, right?

Anyway, that's another weird problem I faced. I'll try to make the protection anyway, but I just can't understand why it happens. I also do not have any chance to test the code, though I hope no one will try to test it.
That doesn't couse a crash no. This does:
Code:
public OnFilterScriptInit()
{
    new empty[16];//not assigning a string, then it is null. If formatting it as "" it will add the /0 character to the first byte

    CallLocalFunction(test,"s",empty);//afaik print doesn't crash with empty strings, calllocalfunction does
    return 1;
}

forward test(aaa[]);
public test(aaa[])
{
    print(aaa);
    return 1;
}
Reply


Messages In This Thread
Vulnerabilities on receiving null commands - by leong124 - 22.12.2012, 08:31
Re: Vulnerabilities on receiving null commands - by ev0lution - 22.12.2012, 09:18
Re: Vulnerabilities on receiving null commands - by AndreT - 22.12.2012, 09:24
Re: Vulnerabilities on receiving null commands - by leong124 - 22.12.2012, 09:32
Re: Vulnerabilities on receiving null commands - by ev0lution - 22.12.2012, 09:59
Re: Vulnerabilities on receiving null commands - by Kar - 23.12.2012, 04:22
Re: Vulnerabilities on receiving null commands - by Lorenc_ - 23.12.2012, 07:17
Re: Vulnerabilities on receiving null commands - by leong124 - 26.12.2012, 18:42
Respuesta: Vulnerabilities on receiving null commands - by Jupit3r - 27.12.2012, 12:20
Re: Vulnerabilities on receiving null commands - by Lorenc_ - 27.12.2012, 22:52
Re: Vulnerabilities on receiving null commands - by leong124 - 28.12.2012, 08:16
Re: Vulnerabilities on receiving null commands - by ikkentim - 05.01.2013, 10:00
Re: Vulnerabilities on receiving null commands - by leong124 - 05.01.2013, 11:46
Re: Vulnerabilities on receiving null commands - by mastermax7777 - 06.01.2013, 04:10
Re: Vulnerabilities on receiving null commands - by leong124 - 06.01.2013, 14:19
Re: Vulnerabilities on receiving null commands - by Karlip - 08.01.2013, 15:47
Re: Vulnerabilities on receiving null commands - by leong124 - 08.01.2013, 19:30
Re: Vulnerabilities on receiving null commands - by kurta999 - 08.01.2013, 20:23
Re: Vulnerabilities on receiving null commands - by leong124 - 09.01.2013, 08:06

Forum Jump:


Users browsing this thread: 1 Guest(s)