From 6ce151b547c9f5b281501fad9501abddb24ce939 Mon Sep 17 00:00:00 2001 From: Howard Wu <HowardWu20@outlook.com> Date: Sat, 22 Jun 2024 01:01:50 +0800 Subject: [PATCH] Check arguments length before reading fix ``` panic: runtime error: index out of range [1] with length 1 goroutine 1 [running]: main.getQuestion() /build/dnslookup/parts/dnslookup/build/main.go:239 +0x147 main.main() /build/dnslookup/parts/dnslookup/build/main.go:44 +0x145 ``` Revert "Check arguments length before reading" This reverts commit 4bc0a249ab49f34a82a3ede1aefe8a4566cb003d. Update main.go --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9c3dd2d..cdbdece 100644 --- a/main.go +++ b/main.go @@ -41,7 +41,6 @@ func main() { do := os.Getenv("DNSSEC") == "1" subnetOpt := getSubnet() ednsOpt := getEDNSOpt() - question := getQuestion() if verbose { log.SetLevel(log.DEBUG) @@ -72,6 +71,8 @@ func main() { os.Exit(1) } + question := getQuestion() + if timeoutStr != "" { i, err := strconv.Atoi(timeoutStr) if err != nil {