-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some fixes about Hysteria 2 #3147
Conversation
} | ||
size := QuicLen(addressLen) + addressLen + QuicLen(paddingLen) + paddingLen |
Check failure
Code scanning / CodeQL
Size computation for allocation may overflow High
allocation
potentially large value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a corrent complaint. Maximum QuicLen is 8, addressLen is validated not to overflow (<= 2048), and paddingLen has a maximum length (511).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there still future work for hysteria2, but I am happy to merge it as is.
This pull request is ready to be merged. Thanks for your contribution.
case packetaddr.PacketAddrType_Packet: | ||
packetAddrDispatcherFactory := udp.NewPacketAddrDispatcherCreator(ctx) | ||
udpDispatcherConstructor = packetAddrDispatcherFactory.NewPacketAddrDispatcher | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to correctly process packet addr fullcone traffic, the incoming stream should be decoded: https://github.com/v2fly/v2ray-core/blob/master/proxy/trojan/client.go#L90 . I can merge this now without requiring additional changes, but another merge request to support packetaddr is welcomed.
padding := make([]byte, paddingLen) | ||
for i := range padding { | ||
padding[i] = paddingChars[rand.Intn(len(paddingChars))] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the padding have to be filled with something, although it is always a good habit to initialize a buffer. It might be changed in the future, but let's keep it that way for now.
padding mechanism reference: https://github.com/apernet/hysteria/blob/master/core/internal/protocol/padding.go.