diff --git a/src/websocketserver/WebSocketServer.cpp b/src/websocketserver/WebSocketServer.cpp index 6b5d89b9..01a4def1 100644 --- a/src/websocketserver/WebSocketServer.cpp +++ b/src/websocketserver/WebSocketServer.cpp @@ -444,6 +444,12 @@ void WebSocketServer::onMessage(websocketpp::connection_hdl hdl, goto skipProcessing; } + if (!incomingMessage["op"].is_number()) { + ret.closeCode = WebSocketCloseCode::UnknownOpCode; + ret.closeReason = "Your `op` is not a number."; + goto skipProcessing; + } + ProcessMessage(session, ret, incomingMessage["op"], incomingMessage["d"]); skipProcessing: