Skip to content

Commit

Permalink
fixed: invalid argument to Intn (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luoxin authored Mar 26, 2024
1 parent 288899a commit 0b4662e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions transport/vmess/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package vmess
import (
"bufio"
"bytes"
"errors"
"fmt"
"net"
"net/http"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0b4662e

Please sign in to comment.