From 0b4662e4b7f52f631112d16a69b81e1a49c8fe42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD=E5=BF=83?= <33619903+Luoxin@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:19:33 +0800 Subject: [PATCH] fixed: invalid argument to Intn (#1133) --- transport/vmess/http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/transport/vmess/http.go b/transport/vmess/http.go index 6da9759e..b023fee4 100644 --- a/transport/vmess/http.go +++ b/transport/vmess/http.go @@ -3,6 +3,7 @@ package vmess import ( "bufio" "bytes" + "errors" "fmt" "net" "net/http" @@ -54,6 +55,10 @@ func (hc *httpConn) Write(b []byte) (int, error) { return hc.Conn.Write(b) } + if len(hc.cfg.Path) == 0 { + return -1, errors.New("path is empty") + } + path := hc.cfg.Path[fastrand.Intn(len(hc.cfg.Path))] host := hc.cfg.Host if header := hc.cfg.Headers["Host"]; len(header) != 0 {