Fix compatibility issue with hosts files

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/847

IP address `0` is a valid synonym of `0.0.0.0`.
This commit is contained in:
Raymond Hill 2020-01-10 11:07:31 -05:00
parent 0ae1e9b1fe
commit f8ec54c635
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -828,7 +828,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
const reIsWhitespaceChar = /\s/; const reIsWhitespaceChar = /\s/;
const reMaybeLocalIp = /^[\d:f]/; const reMaybeLocalIp = /^[\d:f]/;
const reIsLocalhostRedirect = /\s+(?:0\.0\.0\.0|broadcasthost|localhost|local|ip6-\w+)\b/; const reIsLocalhostRedirect = /\s+(?:0\.0\.0\.0|broadcasthost|localhost|local|ip6-\w+)\b/;
const reLocalIp = /^(?:0\.0\.0\.0|127\.0\.0\.1|::1?|fe80::1%lo0)\s+/; const reLocalIp = /^(?:(0\.0\.0\.)?0|127\.0\.0\.1|::1?|fe80::1%lo0)\s+/;
const lineIter = new this.LineIterator(this.processDirectives(rawText)); const lineIter = new this.LineIterator(this.processDirectives(rawText));
while ( lineIter.eot() === false ) { while ( lineIter.eot() === false ) {