Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c786cc5e authored by Jan Kara's avatar Jan Kara Committed by Sasha Levin
Browse files

audit: Fix check of return value of strnlen_user()



[ Upstream commit 0b08c5e59441d08ab4b5e72afefd5cd98a4d83df ]

strnlen_user() returns 0 when it hits fault, not -1. Fix the test in
audit_log_single_execve_arg(). Luckily this shouldn't ever happen unless
there's a kernel bug so it's mostly a cosmetic fix.

CC: Paul Moore <pmoore@redhat.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent eeeec288
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1046,7 +1046,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
	 * for strings that are too long, we should not have created
	 * any.
	 */
	if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
	if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
		WARN_ON(1);
		send_sig(SIGKILL, current, 0);
		return -1;