From d6bf280f90ebfaea11f2341b44e880b32a08938b Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 24 Jan 2016 23:39:40 +0000 Subject: [PATCH] Ensure template string does not contain slashes --- src/functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/functions.php b/src/functions.php index 703d603..b4eaa9e 100644 --- a/src/functions.php +++ b/src/functions.php @@ -82,6 +82,10 @@ function pathTemplate($template) $useRandomInt = function_exists('random_int'); } + if (false !== strpos($template, '\\') || false !== strpos($template, '/')) { + throw new \InvalidArgumentException('Template must not contain back or forward slashes'); + } + $len = 0; if (false !== $pos = strrpos($template, 'X')) {