From 687a2b70a1258f7e9129ecf38c9b91f65d3a6ec8 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 15 Apr 2014 04:14:46 -0700 Subject: Fix memory leaks (don't intern user input). --- dinobot.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'dinobot.rb') diff --git a/dinobot.rb b/dinobot.rb index 690a384..57f980c 100644 --- a/dinobot.rb +++ b/dinobot.rb @@ -78,7 +78,11 @@ module Dinobot def parse_command(user, channel, command, prev=nil) command, remainder = command.split(' | ', 2) - mod = command.scan(/\A\S+/).first.downcase.intern + mod = command.scan(/\A\S+/).first.downcase + + return unless @modules.keys.map { |x| x.to_s }.include?(mod) + + mod = mod.intern if prev.nil? methods = @modules[mod].call(user, channel, command) -- cgit v1.2.3-70-g09d2