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

Fix CTCP parsing to avoid segfault #47

Merged
merged 3 commits into from Dec 21, 2016
Merged

Conversation

djt-code
Copy link
Contributor

Previously, a check for the LastIndex was just ensuring that there WAS a \x01 in the message, and not that the Last character in the string was a \x01

Copy link
Member

@belak belak left a comment

Choose a reason for hiding this comment

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

There's a small change I'd like to see... Also, would it be possible to add a small regression test?

if len(lastArg) > 1 && lastArg[0] == '\x01' &&
lastArg[len(lastArg)-1] == '\x01' {
m.Command = "CTCP"
m.Params[len(m.Params)-1] = strings.Trim(lastArg, "\x01")
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather just trim off the first and last character.

@djt-code
Copy link
Contributor Author

Done!

@belak belak merged commit 1a871c1 into go-irc:master Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants