/*
- * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 1999-2008 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
cs_valid_range(cd, cd + 1, lower_bound, upper_bound) &&
cs_valid_range(cd, (const char *) cd + ntohl(cd->length),
lower_bound, upper_bound) &&
+ cs_valid_range(cd, (const char *) cd + ntohl(cd->hashOffset),
+ lower_bound, upper_bound) &&
+ cs_valid_range(cd, (const char *) cd +
+ ntohl(cd->hashOffset) +
+ (ntohl(cd->nCodeSlots) * SHA1_RESULTLEN),
+ lower_bound, upper_bound) &&
+
ntohl(cd->magic) == CSMAGIC_CODEDIRECTORY) {
return cd;
}
struct ubc_info *uip;
int need_rele = 0;
int need_wakeup = 0;
-#if NAMEDRSRCFORK
- int named_fork = 0;
-#endif
-
+
if (vnode_getwithref(vp))
return;
}
SET(uip->ui_flags, UI_MAPBUSY);
-#if NAMEDRSRCFORK
- if ((vp->v_flag & VISNAMEDSTREAM) &&
- (vp->v_parent != NULLVP) &&
- !(vp->v_parent->v_mount->mnt_kern_flag & MNTK_NAMED_STREAMS)) {
- named_fork = 1;
- }
-#endif
-
if (ISSET(uip->ui_flags, UI_ISMAPPED)) {
- CLR(uip->ui_flags, UI_ISMAPPED);
+ CLR(uip->ui_flags, UI_ISMAPPED);
need_rele = 1;
}
vnode_unlock(vp);
-
+
if (need_rele) {
- (void)VNOP_MNOMAP(vp, vfs_context_current());
-
-#if NAMEDRSRCFORK
- if (named_fork) {
- vnode_relenamedstream(vp->v_parent, vp, vfs_context_current());
- }
-#endif
-
- vnode_rele(vp);
+ (void) VNOP_MNOMAP(vp, vfs_context_current());
+ vnode_rele(vp);
}
vnode_lock_spin(vp);
vnode_unlock(vp);
if (need_wakeup)
- wakeup(&uip->ui_flags);
+ wakeup(&uip->ui_flags);
}
/*
ubc_upl_maxbufsize(
void)
{
- return(MAX_UPL_TRANSFER * PAGE_SIZE);
+ return(MAX_UPL_SIZE * PAGE_SIZE);
}
/*
kern_return_t kr;
pl = UPL_GET_INTERNAL_PAGE_LIST(upl);
- kr = upl_commit(upl, pl, MAX_UPL_TRANSFER);
+ kr = upl_commit(upl, pl, MAX_UPL_SIZE);
upl_deallocate(upl);
return kr;
}
pl = UPL_GET_INTERNAL_PAGE_LIST(upl);
kr = upl_commit_range(upl, offset, size, flags,
- pl, MAX_UPL_TRANSFER, &empty);
+ pl, MAX_UPL_SIZE, &empty);
if((flags & UPL_COMMIT_FREE_ON_EMPTY) && empty)
upl_deallocate(upl);
blob_start_offset = blob->csb_base_offset + blob->csb_start_offset;
blob_end_offset = blob->csb_base_offset + blob->csb_end_offset;
- if (blob_start_offset >= blob_end_offset) {
+ if (blob_start_offset >= blob_end_offset ||
+ blob_start_offset < 0 ||
+ blob_end_offset <= 0) {
/* reject empty or backwards blob */
error = EINVAL;
goto out;
codeLimit = ntohl(cd->codeLimit);
hash = hashes(cd, atop(offset),
lower_bound, upper_bound);
- bcopy(hash, expected_hash, sizeof (expected_hash));
- found_hash = TRUE;
+ if (hash != NULL) {
+ bcopy(hash, expected_hash,
+ sizeof (expected_hash));
+ found_hash = TRUE;
+ }
#if !CS_BLOB_KEEP_IN_KERNEL
/* we no longer need that blob in the kernel map */