mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-13 21:34:25 +00:00
[PR #191] fix: reject jmin > jmax instead of underflowing the junk packet size #195
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amneziawg-go#195
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/amnezia-vpn/amneziawg-go/pull/191
Author: @artromone
Created: 9/3/2026
Status: 🔄 Open
Base:
master← Head:fix/junk-size-range-validation📝 Commits (1)
91a10f3fix: reject jmin > jmax instead of underflowing the junk packet size📊 Changes
2 files changed (+90 additions, -6 deletions)
View changed files
📝
device/uapi.go(+25 -6)➕
device/uapi_test.go(+65 -0)📄 Description
jc/jmin/jmax were written straight to the device as each UAPI line was parsed, so jmin was never checked against jmax. Both values are individually legal, so the pair was accepted. JunkPackets() then does:
With min > max, max-min underflows uint32 and the daemon tries a multi-gigabyte allocation per junk packet.
Stage the junk sizes in ipcSetDevice like the h/s fields, and validate ordering in mergeWithDevice alongside the header overlap and header-protection padding checks. Staging keeps a request that raises both bounds at once (jmin=500 jmax=1000 over a stored jmax=100) working, which a per-line check would reject, and leaves the device untouched when a request is refused.
jmin == jmax stays legal: fastrandn(0) is 0, so every junk packet is exactly jmin bytes.
Refs #189
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.