Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 01-26-2009, 02:46 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Callstack Access

Making an item system, I have a function that looks like this:

PHP Code:
public function addItem(itemidquantity) {
  
// code here
  
temp.callstack getcallstack();
  echo(
"C:" SPC callstack[callstack.size() - 2].scriptcallobject SPC callstack.size());
  
// code here

The problem I'm having is that the callstack does not have an object for scripts that call it outside of a function block. For example, a weapon below:
PHP Code:
findPlayer("cbk1994").addItem(1001); 
Echos "C: 1" meaning that there is only one entry, which is the current object/function.

However, if this is used, it works perfectly:
PHP Code:
function onCreated() {
  
findPlayer("cbk1994").addItem(1001);

Echoes "C: -Guns 2" (-Guns being the name of the weapon)

This is, of course, serverside. It would be great if this could be fixed ASAP, or if someone knows a solution.

Thanks.
__________________
Reply With Quote
  #2  
Old 01-26-2009, 05:28 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
I am probably missing something here, but why would you ever call functions outside of function blocks?

(Also I assume this is for debugging?)
Reply With Quote
  #3  
Old 01-27-2009, 07:56 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Loriel View Post
I am probably missing something here, but why would you ever call functions outside of function blocks?
Normally, you never would; this is to try to catch/prevent abuse of script rights.

PHP Code:
findPlayer("cbk1994").addItem("gun_ak47"5);
function 
onCreated() {
 
// blah

Quote:
Weapon/GUI-Script SomeRandomWeapon has been added/updated by cbk1994!
[note: top line of code is now removed]
Weapon/GUI-Script SomeRandomWeapon has been added/updated by cbk1994!
Tig: Woah, that was fast.
etc.

Right now I'm simply denying anything I can't get the callstack for, and then only allowing it for a list of allowed scripts.

However, I'd like it if I could see what function is trying to add an item so staff can tell if it was an honest glitch, or if someone is trying to abuse powers (Era has had a lot of abuse of power problems lately).
__________________
Reply With Quote
  #4  
Old 01-27-2009, 12:51 PM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by Loriel View Post
I am probably missing something here, but why would you ever call functions outside of function blocks?

(Also I assume this is for debugging?)
In a normal situation, reliable scripters do not do such a thing. However, malicious ones tend to add weapons to themselves using scripts that usually have methods called outside of a function block. Chris is attempting to secure his code with a simple check of the call stack, but this is a problem since the method is called on a global scope.

Chris, why not just eliminate the possibility of a weapon addition on a global scope (or, consequently, through the weapon itself) by only allowing calls that have a total stack size of >1?
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #5  
Old 01-27-2009, 04:23 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Programmer View Post
Chris, why not just eliminate the possibility of a weapon addition on a global scope (or, consequently, through the weapon itself) by only allowing calls that have a total stack size of >1?
I did, but I think it would be a reasonable addition to callstack access to still be able to tell where it's coming from so staff can see that "NPC at (1,5) at era_newlat-mylevel.nw is trying to add items (guns_ak47 x4) to cbk1994!"
__________________
Reply With Quote
  #6  
Old 01-27-2009, 06:00 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by cbk1994 View Post
Normally, you never would; this is to try to catch/prevent abuse of script rights.

[...]

However, I'd like it if I could see what function is trying to add an item so staff can tell if it was an honest glitch, or if someone is trying to abuse powers (Era has had a lot of abuse of power problems lately).
Oh, okay, that is not a situation I would want to be in, but it makes a lot of sense. Carry on, then.
Reply With Quote
  #7  
Old 05-17-2009, 02:32 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
bump
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.