ClassiCube / MCGalaxy

A Minecraft Classic / ClassiCube server software
GNU General Public License v3.0
172 stars 80 forks source link

CPE magic number checked for on preV7 clients #643

Closed rdebath closed 2 years ago

rdebath commented 2 years ago

It fails with a nasty error on V5 and below and worse accepts the CPE request on V6.

Suggest it ignores the inconsistent 0x42 byte.

Connecting ... opened.
Send packet 0x00 (0+131)
000000: 00 03 74 65 73 74 20 20  20 20 20 20 20 20 20 20  ..test..........
000010: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000020: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000030: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000040: 20 20 33 33 63 30 65 63  61 35 65 39 39 64 32 33  ..33c0eca5e99d23
000050: 39 62 63 63 34 38 62 30  34 39 36 36 37 36 63 39  9bcc48b0496676c9
000060: 36 66 20 20 20 20 20 20  20 20 20 20 20 20 20 20  6f..............
000070: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000080: 20 20 42                                          ..B
Received packet 0x0e (14+65)
000000: 0e 55 6e 68 61 6e 64 6c  65 64 20 6f 70 63 6f 64  .Unhandled.opcod
000010: 65 20 22 36 36 22 21 20  20 20 20 20 20 20 20 20  e."66"!.........
000020: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000030: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000040: 20                                                .
Logoff: Unhandled opcode "66"!
Received packet 0x10 (16+67)
000000: 10 4d 43 47 61 6c 61 78  79 20 31 2e 39 2e 33 2e  .MCGalaxy.1.9.3.
000010: 35 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  5...............
000020: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000030: 20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  ................
000040: 20 00 24                                          ..$
Server: MCGalaxy 1.9.3.5
Server has 36 CPE extensions listed
Disconnected.
UnknownShadow200 commented 2 years ago

The field didn't exist in V5 protocol and below, hence why you are kicked for invalid opcode - can't do much about that

but I will change the code to ignore the field when client is using protocol less than V7

rdebath commented 2 years ago

Hmmmm, they why did it succeed if the field exists with value zero ... ouch. Okay, no bug (except my long packet) just really confusing.

rdebath commented 2 years ago

PS: Suggestion: /clients shows "PreClassic 0.xx to 0.yy".