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: stable@vger.kernel.org Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 184416d commit 23a9dbb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • include/linux/sunrpc

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)