Skip to content

fix: zero naive inbound padding bytes to prevent memory leak#4001

Merged
nekohasekai merged 1 commit intoSagerNet:testingfrom
hdrover:fix/naive-padding-leak
Apr 6, 2026
Merged

fix: zero naive inbound padding bytes to prevent memory leak#4001
nekohasekai merged 1 commit intoSagerNet:testingfrom
hdrover:fix/naive-padding-leak

Conversation

@hdrover
Copy link
Copy Markdown
Contributor

@hdrover hdrover commented Apr 6, 2026

This changes the Naive payload padding writes in protocol/naive/inbound_conn.go to zero-fill the extended padding area.

Before:
buffer.Extend(paddingSize)

After:
common.Must(buffer.WriteZeroN(paddingSize))

This makes payload padding match the Naive spec (zeros[padding_size]) and avoids leaking stale pooled-buffer contents in padded DATA frames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants