소스 검색

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>
Jan Kara 10 년 전
부모
커밋
0b08c5e594
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      kernel/auditsc.c

+ 1 - 1
kernel/auditsc.c

@@ -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
 	 * for strings that are too long, we should not have created
 	 * any.
 	 * any.
 	 */
 	 */
-	if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
+	if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
 		WARN_ON(1);
 		WARN_ON(1);
 		send_sig(SIGKILL, current, 0);
 		send_sig(SIGKILL, current, 0);
 		return -1;
 		return -1;