refactor(byteframe): replace read-overflow panic with sticky error

ByteFrame previously panicked on out-of-bounds reads, which crashed
the server when parsing malformed client packets. Now sets a sticky
error (checked via Err()) and returns zero values, matching the
encoding/binary scanner pattern. The session recv loop checks Err()
after parsing to reject malformed packets gracefully.

Also replaces remaining panic("Not implemented") stubs in network
packet Build/Parse methods with proper error returns.
This commit is contained in:
Houmgaor
2026-02-20 20:00:54 +01:00
parent 7c444b023b
commit ac59188488
8 changed files with 105 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
package binpacket
import (
"fmt"
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
@@ -13,7 +15,7 @@ type MsgBinMailNotify struct {
// Parse parses the packet from binary.
func (m MsgBinMailNotify) Parse(bf *byteframe.ByteFrame) error {
panic("implement me")
return fmt.Errorf("MsgBinMailNotify.Parse: not implemented")
}
// Build builds a binary packet from the current data.