mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
websocketserver: Validate op
field type
Could cause a crash by assuming `op` is always a number. Closes #965
This commit is contained in:
parent
de40b53d77
commit
b9a63603c7
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user