mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2010
Posts: 45
B
Ameglian cow
OP Offline
Ameglian cow
B
Joined: May 2010
Posts: 45
So, I had an issue with mIRC and ZNC, the issue being that mIRC did not request the znc.in/server-time-iso CAP when connecting to ZNC. I finally tracked down the issue as to why it didn't, and it turns out mIRC didn't request the multi-prefix CAP either because of this.

I have a script that is processing /debug output, now here comes the problem: I use /tokenize in that script and it seems to break CAP negotiation. Using $gettok to try to get around the problem and use variables instead also breaks CAP negotiation.

When I disable this script mIRC will happily request these 3 CAPs: userhost-in-names multi-prefix znc.in/server-time-iso when they appear in CAP LS. When I enable this script again mIRC will only request userhost-in-names, eventhough the other CAPs are still listed in LS. Very strange.

Here is a sample script that demonstrates this bug:
Code:
alias debugtest {
  var %inout = $gettok($1,1,32)
  return $1
}

Then, execute this command:
Code:
debug -i @debugwindow debugtest

And then connect to ZNC.

Here is sample debug output when its breaking:
Code:
-> znc.ip.znc.ip CAP LS
-> znc.ip.znc.ip PASS mysecretpassword
-> znc.ip.znc.ip NICK BenderUnit
-> znc.ip.znc.ip USER benderunit 0 * :BenderUnit
<- :irc.znc.in CAP unknown-nick LS :userhost-in-names multi-prefix znc.in/server-time-iso znc.in/batch znc.in/self-message
-> znc.ip.znc.ip CAP REQ :userhost-in-names
<- :irc.znc.in CAP BenderUnit ACK :userhost-in-names
-> znc.ip.znc.ip CAP END

And here is sample debug output when its working correctly (when commenting out that var line in the debugtest alias):
Code:
-> znc.ip.znc.ip CAP LS
-> znc.ip.znc.ip PASS mysecretpassword
-> znc.ip.znc.ip NICK BenderUnit
-> znc.ip.znc.ip USER benderunit 0 * :BenderUnit
<- :irc.znc.in CAP unknown-nick LS :userhost-in-names multi-prefix znc.in/server-time-iso znc.in/batch znc.in/self-message
-> znc.ip.znc.ip CAP REQ :userhost-in-names
-> znc.ip.znc.ip CAP REQ :multi-prefix
-> znc.ip.znc.ip CAP REQ :znc.in/server-time-iso
<- :irc.znc.in CAP BenderUnit ACK :userhost-in-names
<- :irc.znc.in CAP BenderUnit ACK :multi-prefix
<- :irc.znc.in CAP BenderUnit ACK :znc.in/server-time-iso
-> znc.ip.znc.ip CAP END


I'm using mIRC 7.41.

Joined: Dec 2002
Posts: 5,427
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,427
Thanks for your bug report. I was able to reproduce this and tracked it down to the use of strtok(), used for tokenization in a number of routines. It turns out that strtok() uses an internal static variable which prevents it from being used in more than one context in a single-threaded application. I have updated all routines to use strtok_s() which is a security enhanced version of strtok() that resolves this issue. This change will be in the next version.

Joined: May 2010
Posts: 45
B
Ameglian cow
OP Offline
Ameglian cow
B
Joined: May 2010
Posts: 45
You're welcome, thank you for fixing it so quick.


Link Copied to Clipboard