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,6 +301,7 @@ func (s *Converter) filterSubsetEndpoints(subset *structs.ServiceResolverSubset,
// used in clusters.go
func makeHostPortEndpoint(host string, port int) *pbproxystate.Endpoint {
if port >= 0 && port <= 65535 {
return &pbproxystate.Endpoint{
Address: &pbproxystate.Endpoint_HostPort{
HostPort: &pbproxystate.HostPortAddress{
@ -309,6 +310,8 @@ func makeHostPortEndpoint(host string, port int) *pbproxystate.Endpoint {
},
},
}
}
return nil
}
func makeUnixSocketEndpoint(path string) *pbproxystate.Endpoint {

View File

@ -764,6 +764,7 @@ 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)
//}
if opts.port >= 0 && opts.port <= 65535 {
return &pbproxystate.Listener{
Name: fmt.Sprintf("%s:%s:%d", opts.name, opts.addr, opts.port),
//AccessLog: accessLog,
@ -775,6 +776,8 @@ func makeListenerWithDefault(opts makeListenerOpts) *pbproxystate.Listener {
},
Direction: opts.direction,
}
}
return nil
}
func makePipeListener(opts makeListenerOpts) *pbproxystate.Listener {