From 51d89b99e85658819b0270f863506109e19c14f4 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sat, 12 Oct 2013 18:25:36 -0500 Subject: [PATCH] Fix a vulnerability in chatMsg handler --- changelog | 3 +++ lib/user.js | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/changelog b/changelog index 557392c7..60b25546 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +Sat Oct 12 18:24 2013 CDT + * lib/user.js: Fix bad chatMsg packet causing exceptions + Sat Oct 12 15:53 2013 CDT * lib/channel.js: Add a try-catch to playlist loading to catch the mysterious error that's been coming up (corrupt pl?) diff --git a/lib/user.js b/lib/user.js index e949e7e2..cff835f7 100644 --- a/lib/user.js +++ b/lib/user.js @@ -229,6 +229,13 @@ User.prototype.initCallbacks = function () { self.socket.on("chatMsg", function (data) { if (self.inChannel()) { + if (typeof data.msg !== "string") { + self.socket.emit("kick", { + reason: "Invalid chatMsg packet!" + }); + self.socket.disconnect(true); + return; + } if (data.msg.indexOf("/afk") !== 0) { self.setAFK(false); self.autoAFK();