View Single Post
10-13-12, 04:49 AM   #1
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
Detecting tainted code

I was just thinking about how Blizzard might be detecting tainted code and then i came up with this simple approach that addon developers could do this sort of thing in their own code.

I'm probably re-inventing the wheel here since this must have been thought of before.
I have not found any need to use something like this in my own addons, was just dabbling with some code.

Code:
--Declaration of the original function
function foo()
	print("This is my orignial un-tainted function");
end
local foo_address = tostring(foo); --Remember locally the address of the original function.

--This will create a new function, overwriting the orignal
function bar() 
	print("Original: "..foo_address);
	
	foo = function() print("This is a tainted function") end;
	print("New: "..tostring(foo));
end
Has anyone had the need for this sort of taint-detection in their addon?

The crux is that the "foo_address" is done right after the original function's declaration and that it's local; thereby not modifiable by external code.
__________________
Author of IfThen, Links in Chat
  Reply With Quote