Skip to content

Commit

Permalink
Use ordinal comparisons when parsing IRC messages.
Browse files Browse the repository at this point in the history
Fixes a bug where messages starting with "combining" Unicode characters cause the parser to fail. Likely improves performance too.
  • Loading branch information
DeathByNukes committed Jul 20, 2013
1 parent 291abb2 commit 309ad84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/IrcClient/IrcClient.cs
Expand Up @@ -901,9 +901,9 @@ public IrcMessageData MessageParser(string rawline)
// conform to RFC 2812
from = linear[0];
messagecode = linear[1];
exclamationpos = from.IndexOf("!");
atpos = from.IndexOf("@");
colonpos = line.IndexOf(" :");
exclamationpos = from.IndexOf("!", StringComparison.Ordinal);
atpos = from.IndexOf("@", StringComparison.Ordinal);
colonpos = line.IndexOf(" :", StringComparison.Ordinal);
if (colonpos != -1) {
// we want the exact position of ":" not beginning from the space
colonpos += 1;
Expand Down

0 comments on commit 309ad84

Please sign in to comment.