Skip to content
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

Enure CTCP from address is valid #1053

Merged
merged 2 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1053.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a crash related to an invalid `ctcp-version` request
4 changes: 3 additions & 1 deletion src/irc/ConnectionInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ export class ConnectionInstance {

private listenForCTCPVersions() {
this.client.addListener("ctcp-version", (from: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If string can be falsey, this signature is incorrect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing the signature?
This from: string should likely be from: string|undefined or ``from: string|null`.

this.client.ctcp(from, 'reply', `VERSION ${CTCP_VERSION}`);
if (from) { // Ensure the sender is valid before we try to respond
this.client.ctcp(from, 'reply', `VERSION ${CTCP_VERSION}`);
}
});
}

Expand Down