-
Notifications
You must be signed in to change notification settings - Fork 17.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: reject leading zeros in IP address parsers
In both net.ParseIP and net.ParseCIDR reject leading zeros in the dot-decimal notation of IPv4 addresses. Fixes #30999 Fixes #43389 Change-Id: I2b6a31fe84db89ac828cf5ed03eaa586ee96ab68 Reviewed-on: https://go-review.googlesource.com/c/go/+/325829 Trust: Roland Shoemaker <roland@golang.org> Trust: Katie Hockman <katie@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
- Loading branch information
1 parent
da4a640
commit d3e3d03
Showing
5 changed files
with
24 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
# See https://tools.ietf.org/html/rfc1123. | ||
# | ||
# The literal IPv4 address parser in the net package is a relaxed | ||
# one. It may accept a literal IPv4 address in dotted-decimal notation | ||
# with leading zeros such as "001.2.003.4". | ||
|
||
# internet address and host name | ||
127.0.0.1 localhost # inline comment separated by tab | ||
127.000.000.002 localhost # inline comment separated by space | ||
127.0.0.2 localhost # inline comment separated by space | ||
|
||
# internet address, host name and aliases | ||
127.000.000.003 localhost localhost.localdomain | ||
127.0.0.3 localhost localhost.localdomain |
We use Gerritt for code review and mirror to GitHub. Very few people see comments on GitHub commits. If you want to comment on this change, please use https://golang.org/cl/325829. Thanks.