close socket if SSID is not valid
This commit is contained in:
@@ -1471,6 +1471,11 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
if (!headers) return;
|
||||
|
||||
if (headers["wtv-client-serial-number"] != null && socket.ssid == null) {
|
||||
if (!wtvshared.checkSSID(headers["wtv-client-serial-number"])) {
|
||||
// close socket for invalid ssid
|
||||
cleanupSocket(socket)
|
||||
return;
|
||||
}
|
||||
socket.ssid = wtvshared.makeSafeSSID(headers["wtv-client-serial-number"]);
|
||||
if (socket.ssid != null) {
|
||||
if (!ssid_sessions[socket.ssid]) {
|
||||
|
||||
@@ -69,6 +69,13 @@ class WTVShared {
|
||||
return crc.toString(16).padStart(2, '0');
|
||||
}
|
||||
|
||||
// check if the SSID has a valid checksum
|
||||
checkSSID(ssid) {
|
||||
if (ssid.slice(-2) == this.getSSIDCRC(ssid))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
parseConfigVars(s) {
|
||||
if (s.indexOf("%ServiceDeps%") >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user