update free-d-decode

This commit is contained in:
Joel Wetzell
2026-05-23 07:57:34 -05:00
parent 4323a21015
commit 5a2aefbdd5
6 changed files with 19 additions and 11 deletions
+9 -1
View File
@@ -21,6 +21,7 @@ func init() {
type FreeDDecode struct {
config config.ProcessorConfig
buf [29]byte
}
func (fd *FreeDDecode) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
@@ -32,7 +33,14 @@ func (fd *FreeDDecode) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, errors.New("freed.decode processor only accepts a []byte")
}
payloadMessage, err := freeD.Decode(payloadBytes)
if len(payloadBytes) != 29 {
wrappedPayload.End = true
return wrappedPayload, errors.New("freeD packet must be exactly 29 bytes")
}
copy(fd.buf[:], payloadBytes)
payloadMessage, err := freeD.Decode(fd.buf)
if err != nil {
wrappedPayload.End = true
return wrappedPayload, err