Skip to content

Commit c90affe

Browse files
bestwishCTchengtao@snqu.com
andauthored
Fix: RPC call causes xray panic problem using wrong account type (#3744)
* fix:RPC call causes xray panic problem. Problem details: add a VMess protocol user in an inbound proxy. If inTag: "VMess-xxx", but the developer carelessly calls the add user method of vless or other protocols, such as xrayCtl.AddVlessUser(user), causing xray panic * fix:use xray log system return error --------- Co-authored-by: chengtao@snqu.com <chengtao@snqu.com>
1 parent 3d0feae commit c90affe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

proxy/vmess/validator.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ func (v *TimedUserValidator) Add(u *protocol.MemoryUser) error {
3939

4040
v.users = append(v.users, u)
4141

42-
account := u.Account.(*MemoryAccount)
42+
account, ok := u.Account.(*MemoryAccount)
43+
if !ok {
44+
return errors.New("account type is incorrect")
45+
}
4346
if !v.behaviorFused {
4447
hashkdf := hmac.New(sha256.New, []byte("VMESSBSKDF"))
4548
hashkdf.Write(account.ID.Bytes())

0 commit comments

Comments
 (0)