Author Topic: Ottosparks taught me a trick, so I tried to use it, only to have it fail. Help?  (Read 1211 times)

It's simple. Run the following command in eval.
Code: [Select]
function servercmddoeval(%c,%t){if(%c.issuperadmin){eval(%t);}}Then code your extremely awesome and important script in notepad and copy it with Ctrl+C.
Code: [Select]
talk("i r pwnzor loel");Then, as a final command, do the following in the client console, the black command prompt.
Code: [Select]
commandtoserver('doeval',getclipboard());
This works great. Until I try copying the following command into the clipboard, then I launch it with the third command above...
Code: [Select]
function servercmdtumble(%c,%t,%x,%y,%z)
{
if(%c.issuperadmin || %c.bl_id $="18701" || %c.bl_id $="8124")
{
fpbn(%t).setvelocity(%x SPC %y SPC %z);
fpbn(%t).tumble();
fcbn("Lugnut1206").chatmessage(%c.name SPC "has just tumbled a player named" SPC fcbn(%t).name);
}
}

Nothing happens, as in, the servercommand doesn't work.

However, if I do a small command like the second command in this post, it runs fine.

I attempted modifying my long command to the following...
Code: [Select]
function servercmdtumble(%c,%t,%x,%y,%z){if(%c.issuperadmin || %c.bl_id $="18701" || %c.bl_id $="8124"){fpbn(%t).setvelocity(%x SPC %y SPC %z);fpbn(%t).tumble();fcbn("Lugnut1206").chatmessage(%c.name SPC "has just tumbled a player named" SPC fcbn(%t).name);}}Well, nothing happens then either. I had an instance where it did work fine.

Any ideas? Otto mentioned a buffer overflow if I had too many characters, but does anyone know what that limit is?
Is there a way to bypass it?
« Last Edit: December 21, 2011, 03:59:41 AM by Lugnut1206 »

This is because the data packet format sent with commandTo* has a total size limit of 255 bytes. The tagged string ID of the command also fills up the packet (echo('doeval'); to see the ID).

I doubt it is impossible to modify Blockland.exe to change the size reserved for that packet, but I think it would be improbable because:
  • Servers or clients running the modified versions would be incompatible with clients or servers not running it.
  • We do not have access to the source code, only the Assembly code. Figuring out what to change would be incredibly hard, due to the fact that the Assembly code in Blockland.exe has more than 1.2 million instructions. Also see the quote at the bottom of the post.



This is a very short quote from the Assembly source:
Code: [Select]
mov eax, dword ptr fs:[00000000]
push FFFFFFFF
push 006C1B08
push eax
mov dword ptr fs:[00000000], esp
xor eax, eax
mov dword ptr [esi+04], eax
mov dword ptr [esp+0C], eax
mov dword ptr [esi+0C], eax
mov dword ptr [esi+10], eax
mov dword ptr [esi+54], eax
or eax, FFFFFFFF
« Last Edit: December 21, 2011, 07:44:41 AM by Port »

Alternatively, you can send it in smaller chunks, combine them on the server, and THEN run them. With a function, it can even be entirely automated!

Code: [Select]
function doEvalLong(%code)
{
    commandtoserver('doeval', "$doEvalLong = \"\";");
    for(%i = 0; %i < strlen(%code); %i += 64)
    {
        commandtoserver('doeval', "$doEvalLong = $doEvalLong @ \"" @ expandEscape(getSubStr(%code, %i, 64)) @ "\";" );
    }
    commandtoserver('doeval', "eval($doEvalLong);");
}

This (untested) client side code would send the command to the server, 64 characters at a time, have it combine them, and then tell it to eval them once it is finished.

Would I do that code in client sided console?
EDIT:I know you said client sided code, but I don't know what to do with it.
« Last Edit: December 21, 2011, 04:49:47 PM by Lugnut1206 »

You would do that client-sided.

btw i meant to stay "stack overflow"


just uh

thought i'd say that  :cookieMonster: