]> Cypherpunks.ru repositories - gostls13.git/commit
net/netip: allow only valid prefix digits in ParsePrefix
authorMauri de Souza Meneguzzo <mauri870@gmail.com>
Wed, 1 Nov 2023 23:19:39 +0000 (23:19 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 6 Nov 2023 21:18:11 +0000 (21:18 +0000)
commitf83bbaf3af8d938bd15429254bbbdcc6d4b42144
tree283edda215b7568bbf82d01c8d548747d88c4c78
parent8a360d68c41f9afd3749636f9fd76802e697832d
net/netip: allow only valid prefix digits in ParsePrefix

The prefix bits for a call to ParsePrefix are passed raw to
strconv.Atoi, this means that it can accept +- signs as well as leading
zeroes, which are not allowed prefix values following RFC 4632 Section
3.1 and RFC 4291 Section 2.3.

Validate non-digit characters as well as leading zeroes and return an
error accordingly.

Fixes #63850

Change-Id: I412a7e1cecc6ee9ea1582d4b04cb40d79ee714f1
GitHub-Last-Rev: 462d97fc5f412e18376356dbc10b63711c084144
GitHub-Pull-Request: golang/go#63859
Reviewed-on: https://go-review.googlesource.com/c/go/+/538860
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/net/netip/netip.go
src/net/netip/netip_test.go