mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-13 20:33:16 +00:00
Fix crash when input bad method in shadowsocks multi-user inbound
This commit is contained in:
parent
7734afc40c
commit
51ce672076
|
@ -70,7 +70,7 @@ func newShadowsocks(ctx context.Context, router adapter.Router, logger log.Conte
|
||||||
case common.Contains(shadowaead_2022.List, options.Method):
|
case common.Contains(shadowaead_2022.List, options.Method):
|
||||||
inbound.service, err = shadowaead_2022.NewServiceWithPassword(options.Method, options.Password, udpTimeout, inbound.upstreamContextHandler())
|
inbound.service, err = shadowaead_2022.NewServiceWithPassword(options.Method, options.Password, udpTimeout, inbound.upstreamContextHandler())
|
||||||
default:
|
default:
|
||||||
err = E.New("shadowsocks: unsupported method: ", options.Method)
|
err = E.New("unsupported method: ", options.Method)
|
||||||
}
|
}
|
||||||
inbound.packetUpstream = inbound.service
|
inbound.packetUpstream = inbound.service
|
||||||
return inbound, err
|
return inbound, err
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
"github.com/sagernet/sing/common/auth"
|
"github.com/sagernet/sing/common/auth"
|
||||||
"github.com/sagernet/sing/common/buf"
|
"github.com/sagernet/sing/common/buf"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
F "github.com/sagernet/sing/common/format"
|
F "github.com/sagernet/sing/common/format"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
)
|
)
|
||||||
|
@ -48,6 +49,9 @@ func newShadowsocksMulti(ctx context.Context, router adapter.Router, logger log.
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = int64(C.UDPTimeout.Seconds())
|
||||||
}
|
}
|
||||||
|
if !common.Contains(shadowaead_2022.List, options.Method) {
|
||||||
|
return nil, E.New("unsupported method: " + options.Method)
|
||||||
|
}
|
||||||
service, err := shadowaead_2022.NewMultiServiceWithPassword[int](
|
service, err := shadowaead_2022.NewMultiServiceWithPassword[int](
|
||||||
options.Method,
|
options.Method,
|
||||||
options.Password,
|
options.Password,
|
||||||
|
|
Loading…
Reference in a new issue