Skip to content

Commit

Permalink
Mask the top 3 bits of the message type
Browse files Browse the repository at this point in the history
Only the lowest 5 bits are actually used to describe the message.

Fixes #7.
  • Loading branch information
xeals committed Apr 26, 2018
1 parent cf07cd1 commit 5241390
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions types/sms.go
Expand Up @@ -166,9 +166,9 @@ func intToTime(n *uint64) *string {
}

func translateSMSType(t uint64) SMSType {
// Just get the lower 8 bits, because everything else is masking.
// Just get the lowest 5 bits, because everything else is masking.
// https://github.com/signalapp/Signal-Android/blob/master/src/org/thoughtcrime/securesms/database/MmsSmsColumns.java
v := uint8(t)
v := uint8(t) & 0x1F

switch v {
// STANDARD
Expand Down

0 comments on commit 5241390

Please sign in to comment.