From 1aeb84750966f9bd1d7a084b692b5efd3a6e7900 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 29 Aug 2015 01:19:50 +0000 Subject: [PATCH] Math.rpn should use _mathSafeEnv, otherwise untrusted users can freeze the bot --- plugins/Math/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Math/plugin.py b/plugins/Math/plugin.py index 518d21c7b..d9d1f1348 100644 --- a/plugins/Math/plugin.py +++ b/plugins/Math/plugin.py @@ -279,8 +279,8 @@ class Math(callbacks.Plugin): x = abs(x) stack.append(x) except ValueError: # Not a float. - if arg in self._mathEnv: - f = self._mathEnv[arg] + if arg in self._mathSafeEnv: + f = self._mathSafeEnv[arg] if callable(f): called = False arguments = [] @@ -303,7 +303,7 @@ class Math(callbacks.Plugin): arg1 = stack.pop() s = '%s%s%s' % (arg1, arg, arg2) try: - stack.append(eval(s, self._mathEnv, self._mathEnv)) + stack.append(eval(s, self._mathSafeEnv, self._mathSafeEnv)) except SyntaxError: irc.error(format(_('%q is not a defined function.'), arg))