diff options
Diffstat (limited to 'src/inbound_group_session.c')
-rw-r--r-- | src/inbound_group_session.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inbound_group_session.c b/src/inbound_group_session.c index f2a310a..82ff66f 100644 --- a/src/inbound_group_session.c +++ b/src/inbound_group_session.c @@ -88,10 +88,10 @@ static size_t _init_group_session_keys( } uint32_t counter = 0; - counter <<= 8; counter |= *ptr++; - counter <<= 8; counter |= *ptr++; - counter <<= 8; counter |= *ptr++; - counter <<= 8; counter |= *ptr++; + // Decode counter as a big endian 32-bit number. + for (unsigned i = 0; i < 4; i++) { + counter <<= 8; counter |= *ptr++; + } megolm_init(&session->initial_ratchet, ptr, counter); megolm_init(&session->latest_ratchet, ptr, counter); |