selinux: check for multiplication overflow in put_entry()
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 6 Jul 2023 13:23:16 +0000 (15:23 +0200)
committerPaul Moore <paul@paul-moore.com>
Tue, 18 Jul 2023 22:29:46 +0000 (18:29 -0400)
commitbbea03f474850b3bce329aa3b990b1a4853136f0
tree1c6577b8697befb5b1ffc7d384de0ae2d3c32fbc
parent5b0eea835d4e9cb5229e696c5763929fc2394f39
selinux: check for multiplication overflow in put_entry()

The function is always inlined and most of the time both relevant
arguments are compile time constants, allowing compilers to elide the
check.  Also the function is part of outputting the policy, which is not
performance critical.

Also convert the type of the third parameter into a size_t, since it
should always be a non-negative number of elements.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/policydb.h