Skip to content

Commit

Permalink
audit: Fix check of return value of strnlen_user()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
jankara authored and pcmoore committed Jun 11, 2015
1 parent 5c1390c commit 0b08c5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,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;
Expand Down

0 comments on commit 0b08c5e

Please sign in to comment.