Skip to content

Commit 0b08c5e

Browse files
jankarapcmoore
authored andcommitted
audit: Fix check of return value of strnlen_user()
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: Jan Kara <jack@suse.cz> Signed-off-by: Paul Moore <pmoore@redhat.com>
1 parent 5c1390c commit 0b08c5e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/auditsc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
10211021
* for strings that are too long, we should not have created
10221022
* any.
10231023
*/
1024-
if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
1024+
if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
10251025
WARN_ON(1);
10261026
send_sig(SIGKILL, current, 0);
10271027
return -1;

0 commit comments

Comments
 (0)