We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b05fcc commit c1989bfCopy full SHA for c1989bf
routine.go
@@ -2,6 +2,7 @@ package wireproxy
2
3
import (
4
"context"
5
+ "crypto/subtle"
6
"errors"
7
"fmt"
8
"io"
@@ -110,7 +111,9 @@ func (config *Socks5Config) SpawnRoutine(vt *VirtualTun) {
110
111
}
112
113
func (c CredentialValidator) Valid(username, password string) bool {
- return c.username == username && c.password == password
114
+ u := subtle.ConstantTimeCompare([]byte(c.username), []byte(username))
115
+ p := subtle.ConstantTimeCompare([]byte(c.password), []byte(password))
116
+ return u&p == 1
117
118
119
func connForward(bufSize int, from io.ReadWriteCloser, to io.ReadWriteCloser) {
0 commit comments