diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-06-12 23:44:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-06-12 23:44:07 +0200 |
commit | e1d32e2258bb4438f761d96613411998f3be8d5f (patch) | |
tree | bee03526d15e68bcbe9ca6c95b42a04930205fdf /src/methods/common.c | |
parent | ed817eb9067976b9d6d134bc0992bbbf883e6675 (diff) | |
download | fastd-e1d32e2258bb4438f761d96613411998f3be8d5f.tar fastd-e1d32e2258bb4438f761d96613411998f3be8d5f.zip |
Fix an undefined shift
Diffstat (limited to 'src/methods/common.c')
-rw-r--r-- | src/methods/common.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/methods/common.c b/src/methods/common.c index d26f009..c6d6519 100644 --- a/src/methods/common.c +++ b/src/methods/common.c @@ -80,12 +80,13 @@ bool fastd_method_reorder_check(fastd_peer_t *peer, fastd_method_common_t *sessi if (age < 0) { size_t shift = age < (-64) ? 64 : ((size_t)-age); - if (shift > 63) + if (shift >= 64) session->receive_reorder_seen = 0; else session->receive_reorder_seen <<= shift; - session->receive_reorder_seen |= (1 << (shift-1)); + if (shift <= 64) + session->receive_reorder_seen |= ((uint64_t)1 << (shift-1)); memcpy(session->receive_nonce, nonce, COMMON_NONCEBYTES); session->reorder_timeout = fastd_in_seconds(REORDER_TIME); |