mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-13 21:34:25 +00:00
[PR #193] fix: reject a negative length argument in <r>/<rc>/<rd>/<dz> tags #198
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#198
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/193
Author: @artromone
Created: 9/3/2026
Status: 🔄 Open
Base:
master← Head:fix/reject-negative-obf-tag-length📝 Commits (1)
9710d69fix: reject a negative length argument in /// tags📊 Changes
6 files changed (+58 additions, -9 deletions)
View changed files
📝
device/obf.go(+15 -0)📝
device/obf_datasize.go(+1 -3)📝
device/obf_rand.go(+1 -2)📝
device/obf_randchars.go(+1 -2)📝
device/obf_randdigits.go(+1 -2)➕
device/obf_test.go(+39 -0)📄 Description
The four length-taking CPS tags parse their argument with strconv.Atoi and store it unchecked, so a negative N in i1-i5 is accepted by set= without error. The value then flows through ObfuscatedLen into make([]byte, ...) and dst[:N], and the daemon panics on the next handshake send with "makeslice: len out of range".
Add parseObfLen and use it in the four builders, so the config is refused at parse time with a message naming the offending tag. Zero stays legal — it simply contributes nothing to the packet.
This only rules out negatives. Whether these lengths should also have an upper bound is a separate policy question and is left alone here.
Refs #189
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.