X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..a991bd8d3e7fe02dbca0644054bab73c5b75324a:/bsd/kern/kern_authorization.c?ds=inline diff --git a/bsd/kern/kern_authorization.c b/bsd/kern/kern_authorization.c index 574d4b198..0181ee93d 100644 --- a/bsd/kern/kern_authorization.c +++ b/bsd/kern/kern_authorization.c @@ -983,7 +983,7 @@ kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp) { int error; kauth_filesec_t fsec; - u_int32_t count; + size_t count; size_t copysize; error = 0; @@ -1006,14 +1006,14 @@ kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp) */ { user_addr_t known_bound = (xsecurity & PAGE_MASK) + KAUTH_FILESEC_SIZE(0); - user_addr_t uaddr = mach_vm_round_page(known_bound); + user_addr_t uaddr = (user_addr_t)mach_vm_round_page(known_bound); count = (uaddr - known_bound) / sizeof(struct kauth_ace); } if (count > 32) { count = 32; } restart: - if ((fsec = kauth_filesec_alloc(count)) == NULL) { + if ((fsec = kauth_filesec_alloc((int)count)) == NULL) { error = ENOMEM; goto out; } @@ -1217,7 +1217,11 @@ kauth_acl_alloc(int count) void kauth_acl_free(kauth_acl_t aclp) { - FREE(aclp, M_KAUTH); + /* + * It's possible this may have have been allocated in a kext using + * MALLOC. Using KHEAP_ANY will allow us to free it here. + */ + kheap_free_addr(KHEAP_ANY, aclp); }