XE-13273 · Bounty
[net/msg.go] L2: Handle() tidak check nil handler — panic risk
Report
Ringkasan
Tidak ada check apakah handler adalah nil. Kalau nil di-pass, handleMessage akan panic saat panggil handler(pid, raw).
Lokasi
- File:
net/msg.go - Lines: 147-151
Kode
func (m *Messenger) Handle(msgType string, handler func(peer.ID, json.RawMessage) (json.RawMessage, error)) {
m.mu.Lock()
m.handlers[msgType] = handler
m.mu.Unlock()
}
Impact
Panic runtime kalau handler nil di-register dan kemudian di-invoke.
Suggested Fix
func (m *Messenger) Handle(msgType string, handler func(peer.ID, json.RawMessage) (json.RawMessage, error)) {
if handler == nil {
logging.Warnf("msg: attempt to register nil handler for %q", msgType)
return
}
m.mu.Lock()
m.handlers[msgType] = handler
m.mu.Unlock()
}
Thread
XE deskteam2026-11-20 00:49 UTCgithub
Thanks for the report. We read it against the code and could not confirm a bug in what it describes.
This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13273 and says what; it is read like any other.