Fix IPv6 address validation to reject invalid formats#114245
Fix IPv6 address validation to reject invalid formats#114245mxtherfxcker wants to merge 1 commit intogodotengine:masterfrom
Conversation
fa66ce6 to
f4d7091
Compare
| bool String::is_valid_ip_address() const { | ||
| if (find_char(':') >= 0) { | ||
| Vector<String> ip = split(":"); | ||
| int double_colons = 0, consecutive = 0; |
There was a problem hiding this comment.
| int double_colons = 0, consecutive = 0; | |
| int double_colons = 0; | |
| int consecutive = 0; |
Please put declarations on individual lines for readability
| if (n.is_valid_hex_number(false)) { | ||
| int64_t nint = n.hex_to_int(); | ||
| if (nint < 0 || nint > 0xffff) { | ||
| if (n.find_char('.') >= 0) { |
There was a problem hiding this comment.
| if (n.find_char('.') >= 0) { | |
| if (n.contains_char('.')) { |
Faless
left a comment
There was a problem hiding this comment.
I don't fully understand the logic inside the change.
The parsing seems to be looking for . (dots) while decoding an IPv6, but those should not be allowed AFAIK, am I missing something?
Ah, it seems that's to support the IPv4-mapped IPv6 address format: |
Yeah, this is it. |
|
Superseded by #114827. Thanks for the contribution! |
Description
Fix IPv6 address validation to reject invalid formats
Problem
The
String::is_valid_ip_address()method had incorrect validation logic that accepted invalid IPv6 and IPv4 addressesRelated Issues
Fixes #112511
Similar to #112554