diff --git a/src/main/kotlin/com/opennxt/ext/ByteBuf.kt b/src/main/kotlin/com/opennxt/ext/ByteBuf.kt index 2a8c705..16e42f8 100644 --- a/src/main/kotlin/com/opennxt/ext/ByteBuf.kt +++ b/src/main/kotlin/com/opennxt/ext/ByteBuf.kt @@ -22,6 +22,8 @@ fun ByteBuf.readString(): String { fun ByteBuf.readNullCircumfixedString(): String { if (readUnsignedByte().toInt() != 0) +fun ByteBuf.readNullCircumfixedString(ignore: Boolean = false): String { + if (readUnsignedByte().toInt() != 0 && !ignore) throw IllegalArgumentException("byte != 0 infront of null-circumfixed string") return readString() } diff --git a/src/main/kotlin/com/opennxt/net/proxy/LoginClientDecoder.kt b/src/main/kotlin/com/opennxt/net/proxy/LoginClientDecoder.kt index 825bfa7..6406733 100644 --- a/src/main/kotlin/com/opennxt/net/proxy/LoginClientDecoder.kt +++ b/src/main/kotlin/com/opennxt/net/proxy/LoginClientDecoder.kt @@ -91,6 +91,7 @@ class LoginClientDecoder : ByteToMessageDecoder() { medium9 = payload.readMedium(), isMember = payload.readUnsignedByte().toInt(), username = payload.readNullCircumfixedString(), + username = payload.readNullCircumfixedString(true), short12 = payload.readUnsignedShort(), int13 = payload.readInt() )