<!-- XE-13282 · [net/msg.go] L11: handleMessage() tidak handle partial message — potensi data loss · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13282>. The page is the record; this is the same page for reading.*

XE-13282 · Bounty

# \[net/msg.go\] L11: handleMessage() tidak handle partial message — potensi data loss

Closed · invalid
—
[xe#427](https://github.com/xeprotocol/xe/issues/427)
filed 2026-11-12 02:49 UTC
by wahyu20260100233-ops

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:51 UTC

Told
:   2026-11-20 00:49 UTC

### Patches

None linked.

### History

- [557275](https://bounty.xe.network/log/557275) 2026-11-20 00:49 UTC reply.mirrored
- [557057](https://bounty.xe.network/log/557057) 2026-11-20 00:48 UTC reply.sent
- [554270](https://bounty.xe.network/log/554270) 2026-11-20 00:37 UTC github.state\_pushed
- [554262](https://bounty.xe.network/log/554262) 2026-11-20 00:37 UTC github.labels
- [553329](https://bounty.xe.network/log/553329) 2026-11-20 00:33 UTC proposal.adopted
- [553120](https://bounty.xe.network/log/553120) 2026-11-20 00:33 UTC proposal.adopted
- [553119](https://bounty.xe.network/log/553119) 2026-11-20 00:33 UTC ticket.status new → closed
- [552532](https://bounty.xe.network/log/552532) 2026-11-20 00:33 UTC proposal.adopted
- [552531](https://bounty.xe.network/log/552531) 2026-11-20 00:33 UTC ticket.facts area
- [552527](https://bounty.xe.network/log/552527) 2026-11-20 00:33 UTC proposal.adopted
- [552526](https://bounty.xe.network/log/552526) 2026-11-20 00:33 UTC ticket.facts
- [551121](https://bounty.xe.network/log/551121) 2026-11-20 00:31 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-13282) · [JSON](https://bounty.xe.network/v1/tickets/XE-13282) · [markdown](https://bounty.xe.network/XE-13282.md)

### Report

## Ringkasan

Kalau message ter-cut (partial), hanya msgType yang dibaca dan payload di-ignore. Tidak ada mechanism untuk handle partial message atau request retransmission.

## Lokasi

- File: `net/msg.go`
- Lines: 100-105

## Kode

```
func (m *Messenger) handleMessage(raw []byte) {
    if len(raw) < 1 {
        return
    }
    msgType := string(raw[0])
    payload := raw[1:]
    handler, ok := m.getHandler(msgType)
    if !ok {
        return
    }
    go handler(peer.ID(raw[0:32]), payload)  // payload bisa partial
}
```

## Impact

Data loss kalau message ter-cut. Handler menerima payload yang tidak lengkap.

## Suggested Fix

Implement message framing dengan length-prefix:

```
func (m *Messenger) handleMessage(raw []byte) {
    if len(raw) < 1 {
        return
    }
    msgType := raw[0]

    // read length dari 4 byte berikutnya
    if len(raw) < 5 {
        // partial message, simpan di buffer
        m.partialBuffer = append(m.partialBuffer, raw...)
        return
    }
    length := binary.BigEndian.Uint32(raw[1:5])
    if uint32(len(raw)-5) < length {
        // partial message, simpan di buffer
        m.partialBuffer = append(m.partialBuffer, raw...)
        return
    }
    payload := raw[5 : 5+length]
    handler, ok := m.getHandler(string(msgType))
    if !ok {
        return
    }
    go handler(peer.ID(raw[5+length : 5+length+32]), payload)
}
```

### Thread

**XE desk**team2026-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-13282 and says what; it is read like any other.
