Skip to content

Commit 67c6545

Browse files
committed
Split this network/this host on this network up in to, per RFC 6890 errata
1 parent 0a5aab6 commit 67c6545

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/filter/logical_filters.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,14 +869,18 @@ static int _php_filter_validate_ipv6(const char *str, size_t str_len, int ip[8])
869869
}
870870
/* }}} */
871871

872-
/* From the tables in RFC 6890 - Special-Purpose IP Address Registries */
872+
/* From the tables in RFC 6890 - Special-Purpose IP Address Registriesi
873+
* Including errata: https://www.rfc-editor.org/errata_search.php?rfc=6890&rec_status=1 */
873874
static bool ipv4_get_status_flags(int ip[8], bool *global, bool *reserved, bool *private)
874875
{
875876
*global = false;
876877
*reserved = false;
877878
*private = false;
878879

879880
if (ip[0] == 0) {
881+
/* RFC 0791 - This network */
882+
*reserved = true;
883+
} else if (ip[0] == 0 && ip[1] == 0 && ip[2] == 0 && ip[3] == 0) {
880884
/* RFC 1122 - This host on this network */
881885
*reserved = true;
882886
} else if (ip[0] == 10) {

0 commit comments

Comments
 (0)