params: Do not go over the limit when getting the string length
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 20 Nov 2023 15:11:43 +0000 (17:11 +0200)
committerKees Cook <keescook@chromium.org>
Fri, 1 Dec 2023 17:51:43 +0000 (09:51 -0800)
commitfd0cd057a1b7351604daa6ffc91dfe28adf7225d
treefb45fc893570915c2f41baacb008412b60671404
parent12cd3cd8c797e07afcc47bc4afa760e4ec75e9d7
params: Do not go over the limit when getting the string length

We can use strnlen() even on early stages and it prevents from
going over the string boundaries in case it's already too long.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231120151419.1661807-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Kees Cook <keescook@chromium.org>
kernel/params.c