From 67ff5ead55adebff2cdaabf4700439ffa5d36d2c Mon Sep 17 00:00:00 2001 From: dingjun Date: Wed, 4 Aug 2021 15:38:49 +0800 Subject: [PATCH] fix crash issue --- upstream.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upstream.go b/upstream.go index b17ae6c..30069d4 100644 --- a/upstream.go +++ b/upstream.go @@ -168,6 +168,9 @@ func initDNSClient(c *conf) { fmt.Fprintf(conn, "CONNECT %s HTTP/1.1\r\nHost: %s\r\n\r\n", addr, addr) r := bufio.NewReader(conn) line, err := r.ReadString('\n') + if err != nil { + return nil, err + } ss := strings.Fields(line) if ss[1] != "200" { return nil, fmt.Errorf("http code %s", ss[1])