fix more incorrect type conversions

pull/21251/head
dduzgun-security 2024-06-04 10:52:44 -04:00
parent 7a2ea4bf92
commit 442dca74e2
No known key found for this signature in database
GPG Key ID: 6C3D93CAE50C7EC9
2 changed files with 21 additions and 15 deletions

View File

@ -301,14 +301,17 @@ func (s *Converter) filterSubsetEndpoints(subset *structs.ServiceResolverSubset,
// used in clusters.go
func makeHostPortEndpoint(host string, port int) *pbproxystate.Endpoint {
return &pbproxystate.Endpoint{
Address: &pbproxystate.Endpoint_HostPort{
HostPort: &pbproxystate.HostPortAddress{
Host: host,
Port: uint32(port),
if port >= 0 && port <= 65535 {
return &pbproxystate.Endpoint{
Address: &pbproxystate.Endpoint_HostPort{
HostPort: &pbproxystate.HostPortAddress{
Host: host,
Port: uint32(port),
},
},
},
}
}
return nil
}
func makeUnixSocketEndpoint(path string) *pbproxystate.Endpoint {

View File

@ -764,17 +764,20 @@ func makeListenerWithDefault(opts makeListenerOpts) *pbproxystate.Listener {
// // Since access logging is non-essential for routing, warn and move on
// opts.logger.Warn("error generating access log xds", err)
//}
return &pbproxystate.Listener{
Name: fmt.Sprintf("%s:%s:%d", opts.name, opts.addr, opts.port),
//AccessLog: accessLog,
BindAddress: &pbproxystate.Listener_HostPort{
HostPort: &pbproxystate.HostPortAddress{
Host: opts.addr,
Port: uint32(opts.port),
if opts.port >= 0 && opts.port <= 65535 {
return &pbproxystate.Listener{
Name: fmt.Sprintf("%s:%s:%d", opts.name, opts.addr, opts.port),
//AccessLog: accessLog,
BindAddress: &pbproxystate.Listener_HostPort{
HostPort: &pbproxystate.HostPortAddress{
Host: opts.addr,
Port: uint32(opts.port),
},
},
},
Direction: opts.direction,
Direction: opts.direction,
}
}
return nil
}
func makePipeListener(opts makeListenerOpts) *pbproxystate.Listener {