forked from TrueCloudLab/frostfs-node
[#607] network: Prevent potential panic in Address.Equal
method
Make `Address.Equal` method to accept value instead of pointer in order to prevent NPE. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
6de0af0650
commit
fdd123ad98
3 changed files with 4 additions and 4 deletions
|
@ -49,7 +49,7 @@ func (a Address) String() string {
|
|||
}
|
||||
|
||||
// Equal compares Address's.
|
||||
func (a Address) Equal(addr *Address) bool {
|
||||
func (a Address) Equal(addr Address) bool {
|
||||
return a.ma.Equal(addr.ma)
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ func multiaddrStringFromHostAddr(host string) (string, error) {
|
|||
// IsLocalAddress returns true if network endpoint from local address
|
||||
// source is equal to network endpoint of passed address.
|
||||
func IsLocalAddress(src LocalAddressSource, addr *Address) bool {
|
||||
return src.LocalAddress().Equal(addr)
|
||||
return src.LocalAddress().Equal(*addr)
|
||||
}
|
||||
|
||||
// HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue