Skip to content

Commit

Permalink
l2tpv3: fix cookie decoding
Browse files Browse the repository at this point in the history
If a 32 bits l2tpv3 frame cookie MSB if set to 1, the cast to uint64_t
cookie will spread 1 to the four most significant bytes.
Then the condition (cookie != s->rx_cookie) becomes false.

Signed-off-by: Alexis Dambricourt <alexis.dambricourt@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
  • Loading branch information
AlexisC0de authored and jasowang committed Jan 11, 2016
1 parent aa7f996 commit 3be9b35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/l2tpv3.c
Expand Up @@ -325,7 +325,7 @@ static int l2tpv3_verify_header(NetL2TPV3State *s, uint8_t *buf)
if (s->cookie_is_64) {
cookie = ldq_be_p(buf + s->cookie_offset);
} else {
cookie = ldl_be_p(buf + s->cookie_offset);
cookie = ldl_be_p(buf + s->cookie_offset) & 0xffffffffULL;
}
if (cookie != s->rx_cookie) {
if (!s->header_mismatch) {
Expand Down

0 comments on commit 3be9b35

Please sign in to comment.