diff --git a/header.go b/header.go
index <HASH>..<HASH> 100644
--- a/header.go
+++ b/header.go
@@ -103,6 +103,7 @@ func (h *header) Marshal(p []byte) (n int) {
 		}
 		p = p[2+len(ext.Bytes):]
 	}
+	*_type = 0
 	if len(p) != 0 {
 		panic("header length changed")
 	}
Terminate extension chains when marshalling header

This is important if the buffer is being reused, and isn't necessarily zeroed.