Skip to content

Commit

Permalink
Add checking that arguments to be sent is actually an object
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Mar 4, 2021
1 parent 1703b84 commit ed726ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/OBSWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class OBSWebSocket extends Socket {
rejectReason = Status.REQUEST_TYPE_NOT_SPECIFIED;
}

if (args && (typeof args !== 'object' || args === null || Array.isArray(args))) {
rejectReason = Status.ARGS_NOT_OBJECT;
}

if (!this._connected) {
rejectReason = Status.NOT_CONNECTED;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Status.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ module.exports = {
status: 'error',
description: 'A Request Type was not specified.'
},
ARGS_NOT_OBJECT: {
status: 'error',
description: 'The supplied argments parameter is not an object.'
},

init() {
for (const key in this) {
Expand Down

0 comments on commit ed726ff

Please sign in to comment.