Skip to content

Commit

Permalink
audit: fix signedness bug in audit_log_execve_info()
Browse files Browse the repository at this point in the history
In the loop, a size_t "len" is used to hold the return value of
audit_log_single_execve_arg(), which returns -1 on error.  In that
case the error handling (len <= 0) will be bypassed since "len" is
unsigned, and the loop continues with (p += len) being wrapped.
Change the type of "len" to signed int to fix the error handling.

	size_t len;
	...
	for (...) {
		len = audit_log_single_execve_arg(...);
		if (len <= 0)
			break;
		p += len;
	}

Signed-off-by: Xi Wang <[email protected]>
Signed-off-by: Eric Paris <[email protected]>
  • Loading branch information
xiw authored and Al Viro committed Jan 17, 2012
1 parent 10d6836 commit 5afb8a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,8 +1362,8 @@ static void audit_log_execve_info(struct audit_context *context,
struct audit_buffer **ab,
struct audit_aux_data_execve *axi)
{
int i;
size_t len, len_sent = 0;
int i, len;
size_t len_sent = 0;
const char __user *p;
char *buf;

Expand Down

0 comments on commit 5afb8a3

Please sign in to comment.