Skip to content

Commit 52b9c81

Browse files
committed
Merge branch 'apw' (xfrm_user fixes)
Merge xfrm_user validation fixes from Andy Whitcroft: "Two patches we are applying to Ubuntu for XFRM_MSG_NEWAE validation issue reported by ZDI. The first of these is the primary fix, and the second is for a more theoretical issue that Kees pointed out when reviewing the first" * emailed patches from Andy Whitcroft <[email protected]>: xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window
2 parents 72c3373 + f843ee6 commit 52b9c81

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/xfrm/xfrm_user.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,14 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es
412412
up = nla_data(rp);
413413
ulen = xfrm_replay_state_esn_len(up);
414414

415-
if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
415+
/* Check the overall length and the internal bitmap length to avoid
416+
* potential overflow. */
417+
if (nla_len(rp) < ulen ||
418+
xfrm_replay_state_esn_len(replay_esn) != ulen ||
419+
replay_esn->bmp_len != up->bmp_len)
420+
return -EINVAL;
421+
422+
if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
416423
return -EINVAL;
417424

418425
return 0;

0 commit comments

Comments
 (0)