Implement testing for illegal characters
authorunc0rr
Mon, 20 Jun 2011 21:40:08 +0400
changeset 5269 e32fc0fcaad0
parent 5268 eedc0f8ed38b
child 5270 df1588234b96
Implement testing for illegal characters
gameServer/Utils.hs
--- a/gameServer/Utils.hs	Mon Jun 20 12:57:44 2011 -0400
+++ b/gameServer/Utils.hs	Mon Jun 20 21:40:08 2011 +0400
@@ -75,7 +75,9 @@
             t : replaceTeam tm ts
 
 illegalName :: B.ByteString -> Bool
-illegalName s = B.null s || B.all isSpace s || isSpace (B.head s) || isSpace (B.last s)
+illegalName s = B.null s || B.all isSpace s || isSpace (B.head s) || isSpace (B.last s) || B.any isIllegalChar s
+    where
+        isIllegalChar c = c `List.elem` "$()*+?[]^{|}"
 
 protoNumber2ver :: Word16 -> B.ByteString
 protoNumber2ver v = Map.findWithDefault "Unknown" v vermap