ParlorNet
Turn-based game server for any computer, old or new
Clients | Protocols | Browsers | Telnet programs | Docs | Source

Reversi The Eclipse 1.2: the mangled host name

Status: 2026-11-21. Static analysis of the user's copy (fat application: PowerPC PEF in the data fork, 68k CODE resources in the resource fork). Addresses are offsets into the PEF code section (PowerPC) or into CODE 1 after its 4-byte header (68k). The analysis ran no code. Items not checked are marked UNVERIFIED.

Result

Where the host name goes

PowerPC (same flow in the 68k code):

  1. Login dialog (PPob 4 "Login", edit field Host) handler at 0x157bc: GetDescriptor into a Str255 at 0x15f84, P2CStr at 0x160ec, then std::string(cstr) at 0x16100.
  2. IOSComm constructor 0x19164 keeps the string at this+0x94.
  3. IOSComm::Run 0x19c70 creates the telnet object: MyTelnet::MyTelnet(host, port) at 0x18308.
  4. In that constructor, 0x183d4-0x18418: strcpy(buf, host.c_str()), n = strlen(buf), memcpy(buf + 1, buf, n) (0x79f54, a wrapper that calls BlockMoveData(src, dst, n)), buf[0] = n. The Pascal string then goes to PowerPlant LInternetAddress::SetHostName (vtable +0x24, 0x184d0) and on to LOpenTptInetMapper::NameToAddress (0x46bf8: CopyPStr, p2cstr, OTInetStringToAddress) or to a DNSAddress for OTConnect (0x4c6ac).

68k, CODE 1 "Eclipse source", MyTelnet::MyTelnet at 0x16ca0 (identified by the same constants: buffer sizes 10000 at +0x178 and 1000 at +0x184, vtable calls +0x24 and +0x2c):

16d28  lea     -$100(a6),a0 ; movea.l a3,a1 ; move.b (a1)+,(a0)+ loop   strcpy
16d34  ...                                                         strlen -> d3, d4
16d44  lea     -$ff(a6),a1            dst = buf + 1
16d48  lea     -$100(a6),a0           src = buf
16d4c  move.l  d4,d0                  n
16d4e  moveq   #$20,d1
16d50  cmp.l   d1,d0
16d52  bcs.b   $16d58                 n < 32: inline loop
16d54  _BlockMoveData ($A22E)         n >= 32: OS call (overlap-safe)
16d56  bra.b   $16d66
16d58  tst.l d0 ; beq
16d5e  move.b  (a0)+,(a1)+            forward byte copy: buf[1]=buf[0], buf[2]=buf[1]=buf[0], ...
16d60  subq.l #1,d0 ; bne
16d66  move.b  d3,-$100(a6)           length byte

The same inline pattern occurs about 60 times in the 68k code; this is the only one found whose destination overlaps its source above the source (the other in-place copies shift left or copy between separate buffers).

Why it is not Mac OS or the emulator (PowerPC path checked as well)

Before the 68k finding the PowerPC path was checked against Mac OS 9.2.2 and QEMU:

The patch

One branch in the 68k CODE 1 is replaced by NOP, so every length goes to _BlockMoveData:

resourceCODE 1, code offset 0x16d52 (resource data offset 0x16d56)
resource fork file offset0x1eb7ec (decimal 2013164)
bytes65 04 (bcs.b $16d58) -> 4E 71 (nop)
data fork (PowerPC), Finder infounchanged

Disassembly after the patch: cmp.l d1,d0 ; nop ; _BlockMoveData ; bra.b $16d66. d0 still holds the length, a0/a1 source and destination, as the _BlockMoveData branch already expected; _BlockMoveData is already used at this spot for long names and in about 60 other places, so System 7.6.1 has it.

Files (SHA-256):

fileoriginalpatched
data fork037e1161e9d96c8eca4c6444a0636598df9c97e73ca11d4f8ebb7d5df4a94353same
resource forkef6ea99590ec32af41cfbcc4ceb92e3c3a47cf526ec6f927e5d350ef66c7ca2c5ec1db45fe4575fc5ca50e8d840f659a9b8779f99eadfdc2001619a8e366df7e
Finder infofa0758e42ef87cb984fa7f90837aebddac5f02a0e9a2351db3eed9a4c0a5c271same

The patched copy was made from the user's own copy and is not distributed.

Test: on the 68k machine open the 1.2p copy and connect to parlornet.org port 6503. Without the patch, a host name of 32 or more characters would also avoid the bug.

Earlier versions and public patches

This doc on GitHub


 These pages cover every ParlorNet server. | Source code | ParlorNet is free software.