mirror of https://gitee.com/openkylin/linux.git
xfrm: Fix off by one in the replay advance functions
We may write 4 byte too much when we reinitialize the anti replay window in the replay advance functions. This patch fixes this by adjusting the last index of the initialization loop. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
665c8c8ee4
commit
e756682c8b
|
@ -265,7 +265,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
|
|||
bitnr = bitnr & 0x1F;
|
||||
replay_esn->bmp[nr] |= (1U << bitnr);
|
||||
} else {
|
||||
nr = replay_esn->replay_window >> 5;
|
||||
nr = (replay_esn->replay_window - 1) >> 5;
|
||||
for (i = 0; i <= nr; i++)
|
||||
replay_esn->bmp[i] = 0;
|
||||
|
||||
|
@ -471,7 +471,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq)
|
|||
bitnr = bitnr & 0x1F;
|
||||
replay_esn->bmp[nr] |= (1U << bitnr);
|
||||
} else {
|
||||
nr = replay_esn->replay_window >> 5;
|
||||
nr = (replay_esn->replay_window - 1) >> 5;
|
||||
for (i = 0; i <= nr; i++)
|
||||
replay_esn->bmp[i] = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue