From 35b3d92bdd1a56a5e67bbe3bfb5b92d02262b44a Mon Sep 17 00:00:00 2001 From: JackDoan Date: Wed, 14 Oct 2026 15:27:05 -0500 Subject: [PATCH] handshake: Let a payload's certificate alias the decrypted message rather than copying it --- handshake/payload.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handshake/payload.go b/handshake/payload.go index 7f6f8de9..f4bbfaad 100644 --- a/handshake/payload.go +++ b/handshake/payload.go @@ -72,7 +72,8 @@ func MarshalPayload(out []byte, p Payload) []byte { return append(out, rest...) } -// UnmarshalPayload decodes a protobuf-encoded NebulaHandshake message. +// UnmarshalPayload decodes a protobuf-encoded NebulaHandshake message. The +// returned Cert aliases b. func UnmarshalPayload(b []byte) (Payload, error) { var p Payload @@ -127,7 +128,7 @@ func unmarshalPayloadDetails(p *Payload, b []byte) error { if n < 0 { return errInvalidHandshakeDetails } - p.Cert = append([]byte(nil), v...) + p.Cert = v b = b[n:] case fieldInitiatorIndex: if typ != protowire.VarintType {