Skip to content

Commit e9a0604

Browse files
committed
Check for empty strings becofe isDigit()
1 parent 8bab5d9 commit e9a0604

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

dnscrypt-proxy/proxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (proxy *Proxy) registerLocalDoHListener(listener *net.TCPListener) {
129129
func (proxy *Proxy) addDNSListener(listenAddrStr string) {
130130
udp := "udp"
131131
tcp := "tcp"
132-
isIPv4 := isDigit(listenAddrStr[0])
132+
isIPv4 := len(listenAddrStr) > 0 && isDigit(listenAddrStr[0])
133133
if isIPv4 {
134134
udp = "udp4"
135135
tcp = "tcp4"
@@ -209,7 +209,7 @@ func (proxy *Proxy) addDNSListener(listenAddrStr string) {
209209

210210
func (proxy *Proxy) addLocalDoHListener(listenAddrStr string) {
211211
network := "tcp"
212-
isIPv4 := isDigit(listenAddrStr[0])
212+
isIPv4 := len(listenAddrStr) > 0 && isDigit(listenAddrStr[0])
213213
if isIPv4 {
214214
network = "tcp4"
215215
}

0 commit comments

Comments
 (0)