Skip to content

Commit

Permalink
Validate port
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyisaev2 committed Dec 27, 2024
1 parent 6112727 commit 6d51f30
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ func StringToEndpoint(s string) (*api_common.TGenericEndpoint, error) {
return nil, fmt.Errorf("invalid port: %s", ss[1])
}

Check warning on line 25 in common/endpoint.go

View check run for this annotation

Codecov / codecov/patch

common/endpoint.go#L22-L25

Added lines #L22 - L25 were not covered by tests

if port > 65535 {
return nil, fmt.Errorf("invalid port: %s", ss[1])
}

Check warning on line 29 in common/endpoint.go

View check run for this annotation

Codecov / codecov/patch

common/endpoint.go#L27-L29

Added lines #L27 - L29 were not covered by tests

return &api_common.TGenericEndpoint{
Host: ss[0],
Port: uint32(port),
Expand Down

0 comments on commit 6d51f30

Please sign in to comment.