diff options
Diffstat (limited to 'src/scalevalapokalypsi/Server/Client.scala')
-rw-r--r-- | src/scalevalapokalypsi/Server/Client.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/scalevalapokalypsi/Server/Client.scala b/src/scalevalapokalypsi/Server/Client.scala index d689356..5727fc6 100644 --- a/src/scalevalapokalypsi/Server/Client.scala +++ b/src/scalevalapokalypsi/Server/Client.scala @@ -3,6 +3,7 @@ package scalevalapokalypsi.Server import java.net.Socket import scala.math.{min,max} import scalevalapokalypsi.constants.* +import scalevalapokalypsi.utils.* import ServerProtocolState.* import scalevalapokalypsi.Model.Action import scalevalapokalypsi.Model.Entities.Player @@ -113,8 +114,7 @@ class Client(val socket: Socket): val rest = this.incompleteMessage.drop(nextCRLF + 2) this.incompleteMessage = rest ++ Array.fill(nextCRLF + 1)(0.toByte) this.incompleteMessageIndex = 0 - // TODO: the conversion may probably be exploited to crash the server - Some(String(message)) + byteArrayToString(message) else None @@ -178,7 +178,7 @@ class Client(val socket: Socket): this.singStartTime = None - case None => + case None if isPrintable(line) => val action = Action(line) val takesATurn = this.character.exists(p => action.execute(p)) @@ -186,6 +186,10 @@ class Client(val socket: Socket): this.addDataToSend(s"$ACTION_BLOCKING_INDICATOR") this.turnUsed = true + case None => + + () // There were some illegal chars but whatever + end executeLine end Client |