Skip to content

Commit 23a9dbb

Browse files
Dan Carpenterchucklever
authored andcommitted
NFSD: prevent integer overflow on 32 bit systems
On a 32 bit system, the "len * sizeof(*p)" operation can have an integer overflow. Cc: [email protected] Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 184416d commit 23a9dbb

File tree

1 file changed

+2
-0
lines changed
  • include/linux/sunrpc

1 file changed

+2
-0
lines changed

include/linux/sunrpc/xdr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,8 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr,
731731

732732
if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0))
733733
return -EBADMSG;
734+
if (len > SIZE_MAX / sizeof(*p))
735+
return -EBADMSG;
734736
p = xdr_inline_decode(xdr, len * sizeof(*p));
735737
if (unlikely(!p))
736738
return -EBADMSG;

0 commit comments

Comments
 (0)