AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
25.5k stars 1.83k forks source link

Slice bounds out of range [:1] with length 0 #4297

Closed RikP closed 2 years ago

RikP commented 2 years ago

Issue Details

Expected Behavior

Start without crashing

Actual Behavior

The system crashes on startup

Additional Information

Logs: 2022/02/16 16:36:18.403915 [info] AdGuard Home, version v0.106.3

2022/02/16 16:36:18.408092 [info] Initializing auth module: /opt/adguardhome/work/data/sessions.db 2022/02/16 16:36:18.408338 [info] auth: initialized. users:1 sessions:2 2022/02/16 16:36:18.408343 [info] Initialize web module 2022/02/16 16:36:18.421711 [info] AdGuard Home is available on the following addresses: 2022/02/16 16:36:18.426146 [info] Go to http://127.0.0.1:3000 2022/02/16 16:36:18.426155 [info] Go to http://[::1]:3000 2022/02/16 16:36:18.426158 [info] Go to http://192.168.178.11:3000 2022/02/16 16:36:18.426161 [info] Go to http://[xxx:xxx:xxx:xxx::2]:3000 < removed ipv6 address > 2022/02/16 16:36:18.581539 [info] Starting the DNS proxy server 2022/02/16 16:36:18.581549 [info] Ratelimit is enabled and set to 20 rps 2022/02/16 16:36:18.581551 [info] The server is configured to refuse ANY requests 2022/02/16 16:36:18.581553 [info] DNS cache is enabled 2022/02/16 16:36:18.581555 [info] MaxGoroutines is set to 50 2022/02/16 16:36:18.581559 [info] Creating the UDP server socket 2022/02/16 16:36:18.581617 [info] Listening to udp://[::]:53 2022/02/16 16:36:18.581622 [info] Creating a TCP server socket 2022/02/16 16:36:18.581649 [info] Listening to tcp://[::]:53 2022/02/16 16:36:18.581762 [info] Entering the UDP listener loop on [::]:53 2022/02/16 16:36:18.581804 [info] Entering the tcp listener loop on [::]:53 panic: runtime error: slice bounds out of range [:1] with length 0

goroutine 41 [running]: github.com/AdguardTeam/dnsproxy/proxy.(Proxy).LookupIPAddr(0xc000162c00, 0xd531a5, 0x0, 0xd531a5, 0x1, 0xc00008d75d, 0xffffffffffffffff, 0x0) github.com/AdguardTeam/dnsproxy@v0.37.4/proxy/lookup.go:42 +0x3b9 github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(Server).Resolve(0xc00012d400, 0xd531a5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) github.com/AdguardTeam/AdGuardHome/internal/dnsforward/dnsforward.go:216 +0xaa github.com/AdguardTeam/AdGuardHome/internal/home.customDialContext(0x147d140, 0xc00006a360, 0xd53945, 0x3, 0xd531a5, 0x1, 0x0, 0x0, 0x0, 0x0) github.com/AdguardTeam/AdGuardHome/internal/home/home.go:684 +0x1de net/http.(Transport).dial(0xc000134000, 0x147d140, 0xc00006a360, 0xd53945, 0x3, 0xd531a5, 0x1, 0x0, 0x0, 0x0, ...) net/http/transport.go:1144 +0x1fd net/http.(Transport).dialConn(0xc000134000, 0x147d140, 0xc00006a360, 0xc0001521b0, 0xc000034230, 0x5, 0xc0008c0020, 0x19, 0x0, 0xc000240120, ...) net/http/transport.go:1582 +0x1adb net/http.(Transport).dialConnFor(0xc000134000, 0xc000116370) net/http/transport.go:1424 +0xc6 created by net/http.(Transport).queueForDial net/http/transport.go:1393 +0x40f

RikP commented 2 years ago

seems i found it. i had a http_proxy configured which was causing this. Removed it and now it seems to work.