diff options
| author | user <user@clank> | 2026-07-17 23:03:43 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-17 23:03:43 +0200 |
| commit | 3b856b3d009b99d01cb84727b803735937a44d16 (patch) | |
| tree | 30c12ac18a260dea12f27688013cbd46870248e0 /tools | |
| parent | gbhub: control socket + gbtype to inject shell input without the OSK (diff) | |
| download | gbos-3b856b3d009b99d01cb84727b803735937a44d16.tar.gz gbos-3b856b3d009b99d01cb84727b803735937a44d16.tar.xz gbos-3b856b3d009b99d01cb84727b803735937a44d16.zip | |
irc: strip mIRC formatting, drop 004/005 noise, fix a RAM-bank-swap landmine
Against the real irc.sl0p.foo (via a TLS-stripping socat proxy) the
client's screen filled with garbage after connect. Two causes:
1. Color/format codes. The MOTD is a mIRC-color ASCII-art logo. We
dropped the \x03 control byte (term ignores <32) but left its numeric
*arguments*, so the logo rendered as digit soup ('09> stream the
work', '030903 030903 ...'). strip_fmt() now removes \x03 color (+its
fg[,bg] digits), \x04 hex color, and the \x02/\x0f/\x11/\x16/\x1d/
\x1e/\x1f toggles, applied to the trailing text of every line (leaving
\x01 for CTCP). Standalone digits like '3 apples' are untouched.
2. The real bug: handle() defaulted pfx/txt to a read-only "" literal,
and both bang(pfx) and strip_fmt(txt) write a NUL terminator into it.
That literal lives in ROM (000-FFF); on MBC5 a write there is a
RAM-bank-select, silently swapping the cart-RAM bank - where
every static lives - out from under the program. One prefix-less or
empty-trailing server line (real ircds send them: NOTICE AUTH, ERROR,
registration PING) and all state turns to garbage. Fixed with a
writable 1-byte 'empty' default (zeroed in main; gbos doesn't clear
BSS).
Also suppress 004 (MYINFO) and 005 (ISUPPORT) - pure noise on 40 cols,
and InspIRCd splits ISUPPORT across several lines.
Verified end to end against the live server: full InspIRCd MOTD (logo,
LUSERS, links) renders clean and stable; host unit tests cover color/
bold/CTCP-action stripping and prefix-less NOTICE/ERROR/PING.
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions
