diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-02-04 00:14:06 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-02-04 00:14:06 +0000 |
commit | 2301c52905434ec7d392e614c9af6f852b2388c4 (patch) | |
tree | d36b46197f646b0b9477ba137dc053de8822bf7b /sys/security/audit | |
parent | 0bab7ecd73b29c219c1b323da1c9c201e790744b (diff) | |
download | FreeBSD-src-2301c52905434ec7d392e614c9af6f852b2388c4.zip FreeBSD-src-2301c52905434ec7d392e614c9af6f852b2388c4.tar.gz |
Cast pointers to (uintptr_t) before down-casting to (int). This avoids
an incompatible conversion from a 64-bit pointer to a 32-bit integer on
64-bit platforms. We will investigate whether Solaris uses a 64-bit
token here, or a new record here, in order to avoid truncating user
pointers that are 64-bit. However, in the mean time, truncation is fine
as these are rarely/never used fields in audit records.
Obtained from: TrustedBSD Project
Diffstat (limited to 'sys/security/audit')
-rw-r--r-- | sys/security/audit/audit_bsm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/security/audit/audit_bsm.c b/sys/security/audit/audit_bsm.c index 1a2c5e5..17df7f6 100644 --- a/sys/security/audit/audit_bsm.c +++ b/sys/security/audit/audit_bsm.c @@ -683,7 +683,8 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) kau_write(rec, tok); } if (ARG_IS_VALID(kar, ARG_ADDR)) { - tok = au_to_arg32(1, "arg", (u_int32_t)ar->ar_arg_addr); + tok = au_to_arg32(1, "arg", + (u_int32_t)(uintptr_t)ar->ar_arg_addr); kau_write(rec, tok); } if (ARG_IS_VALID(kar, ARG_VNODE1)) { @@ -732,7 +733,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) case AUE_LOADSHFILE: if (ARG_IS_VALID(kar, ARG_ADDR)) { tok = au_to_arg32(4, "base addr", - (u_int32_t)ar->ar_arg_addr); + (u_int32_t)(uintptr_t)ar->ar_arg_addr); kau_write(rec, tok); } UPATH1_VNODE1_TOKENS; @@ -766,7 +767,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) case AUE_MINHERIT: if (ARG_IS_VALID(kar, ARG_ADDR)) { tok = au_to_arg32(1, "addr", - (u_int32_t)ar->ar_arg_addr); + (u_int32_t)(uintptr_t)ar->ar_arg_addr); kau_write(rec, tok); } if (ARG_IS_VALID(kar, ARG_LEN)) { @@ -832,7 +833,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) case AUE_RESETSHFILE: if (ARG_IS_VALID(kar, ARG_ADDR)) { tok = au_to_arg32(1, "base addr", - (u_int32_t)ar->ar_arg_addr); + (u_int32_t)(uintptr_t)ar->ar_arg_addr); kau_write(rec, tok); } break; @@ -870,7 +871,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) } if (ARG_IS_VALID(kar, ARG_ADDR)) { tok = au_to_arg32(3, "addr", - (u_int32_t)ar->ar_arg_addr); + (u_int32_t)(uintptr_t)ar->ar_arg_addr); kau_write(rec, tok); } if (ARG_IS_VALID(kar, ARG_VALUE)) { @@ -1044,7 +1045,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) } if (ARG_IS_VALID(kar, ARG_SVIPC_ADDR)) { tok = au_to_arg32(2, "shmaddr", - (int)ar->ar_arg_svipc_addr); + (int)(uintptr_t)ar->ar_arg_svipc_addr); kau_write(rec, tok); } if (ARG_IS_VALID(kar, ARG_SVIPC_PERM)) { @@ -1083,7 +1084,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) case AUE_SHMDT: if (ARG_IS_VALID(kar, ARG_SVIPC_ADDR)) { tok = au_to_arg32(1, "shmaddr", - (int)ar->ar_arg_svipc_addr); + (int)(uintptr_t)ar->ar_arg_svipc_addr); kau_write(rec, tok); } break; |