-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Certain MODE messages could access on undefined #144
Comments
Here's another error, after modifying the file like so: // channel user modes
var user = modeArgs.shift();console.log('MODE', user, channel.users[user]);
Line in question: Line 239 in 35ee099
|
It seems that it's not actually shifting off arguments when it's supposed to be:
with the following line changed: var user = modeArgs.shift();console.log('MODE', mode, self.prefixForMode, user, channel.users[user]); |
I think I just ran into a similar issue--mode change caused node-irc to attempt to run a method on undefined:
|
I believe the problem lies here: var modeArg;
// channel modes
if ( mode.match(/^[bkl]$/) ) {
modeArg = modeArgs.shift();
if ( modeArg.length === 0 )
modeArg = undefined;
} The module is not handling Freenode's +-q argument, and so the +-o mode is getting the argument intended for +-q. This can be replicated in any channel by doing the same, OPing yourself, then passing I'd make a few changes here, first, the length property is typically reserved for Arrays, for strings, standard boolean identity suffices, and prevents a length lookup on var modeArg;
// channel modes
if ( mode.match(/^[bkl]$/) ) {
modeArg = modeArgs.shift() || undefined;
} Second, the module needs to respect the CHANMODES property, and properly differentiate between channel-user modes, channel modes with arguments, channel-user-address modes, and no-argument modes, and emit an error when it doesn't understand one of the modes not explicitly on one of those four lists. This is hinted nicely on line 252: Line 239 in 35ee099
// TODO - deal nicely with channel modes that take args |
I added the basic support for differentiating between the types of modes in late October (see |
I'm working on that right now |
Any word on this? |
My patch is still awaiting merge. /me pokes |
Yeah, I saw -- I believe this is the bug that's causing our IRC bot to crash occasionally, so I figured I'd give it a prod anyway. |
any news to the merge status? My bot keeps crashing on slack IRC because of this |
This can be closed. |
Fixed in #351. |
Presently I'm looking at
node-irc/lib/irc.js
Lines 229 to 239 in 35ee099
This has occasionally crashed when a non-user value is passed as an argument:
Usually it works fine though, and I can't quite figure out why. But examining the code, almost certainly the server is capable of crafting a response that will throw a TypeError, disconnecting the IRC connection, and this should never happen.
On a similar note, the debug should probably look more like so:
The text was updated successfully, but these errors were encountered: