Skip to content

Commit

Permalink
fix nil pointer dereference in marshal binary of join cluster response
Browse files Browse the repository at this point in the history
  • Loading branch information
chengshiwen committed Jul 11, 2024
1 parent 86054ea commit 71cb30c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions coordinator/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1326,10 +1326,12 @@ type JoinClusterResponse struct {

func (r *JoinClusterResponse) MarshalBinary() ([]byte, error) {
var pb internal.JoinClusterResponse
pb.Node = &internal.NodeInfo{
ID: proto.Uint64(r.Node.ID),
Addr: proto.String(r.Node.Addr),
TCPAddr: proto.String(r.Node.TCPAddr),
if r.Node != nil {
pb.Node = &internal.NodeInfo{
ID: proto.Uint64(r.Node.ID),
Addr: proto.String(r.Node.Addr),
TCPAddr: proto.String(r.Node.TCPAddr),
}
}
if r.Err != nil {
pb.Err = proto.String(r.Err.Error())
Expand Down

0 comments on commit 71cb30c

Please sign in to comment.