execute_string("x = " + argument0);
return x;but soon found that malicious injection of statements wouldn't raise the error it obviously should. Since this will be a component of an online game, I'm working from the "professional paranoia" model and trying to make each section of my game self-secure without relying on other sections, so the possibility for malicious code injection is obviously a huge problem.Maybe giving some context would help. In the big picture, I'm trying to write a stand-in for the assert statement, which is left out of Game Maker.
Ideally, my assert statement would look like this:
assert("a < b");And if a >= b it would show a message saying assert("a < b") failed. and end the game.The way I'm thinking of coding this function is something like the following:
/* assert(expr)
Evaluates the expression, informs the user and ends the game if it is false. */
if eval(argument0)
return true;
show_message("assert('"argument0 + "') failed.");
game_end();Can anyone provide me with a way to evaluate expressions in strings without being vulnerable to malicious code injection?
Or, failing that, maybe a different way to code the assert?
Edited by §-«»-§, 17 May 2009 - 06:24 PM.











