From 60cc569faaa2dc9eb12172cfaf6a8803d84f402f Mon Sep 17 00:00:00 2001 From: Fbenas Date: Thu, 15 May 2014 21:58:44 +0100 Subject: Sanitised inputs mofo! --- Blatech.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Blatech.php b/Blatech.php index c1b477e..701f2c2 100644 --- a/Blatech.php +++ b/Blatech.php @@ -32,6 +32,9 @@ class Blatech */ public function runCommand($message, $args) { + // Sanitise arguments + $args = static::sanitiseArgs($args); + var_dump($args); $nick = ltrim(explode('!', $message[0])[0],":"); $channel = $message[2]; @@ -59,4 +62,9 @@ class Blatech } } } + + private static function sanitiseArgs($string) + { + return preg_replace('/[^a-z\d_+:@#~!?\\/"\'£$%^*(){}\-\][=,.< >]/iu', '', $string); + } } -- cgit v1.2.3