Skip to content

Commit

Permalink
Refuse processing payload with values higher than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
BertoldVdb committed Nov 19, 2019
1 parent 2270b61 commit 8b86faa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aisnmea/nmea.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func (nc *NMEACodec) EncodeSentence(p VdmPacket) []string {
value := byte(0)
bitsUsed := 0
for i := 0; i < len(p.Payload); i++ {
if p.Payload[i] > 1 {
return nil
}

value <<= 1
value += p.Payload[i]
bitsUsed++
Expand Down

0 comments on commit 8b86faa

Please sign in to comment.