Don't peek into MD structures from MI code. The getcontext(3) and

setcontext(3) functions check the validify of the mcontext_t structs.
This commit is contained in:
mini 2002-09-20 08:13:21 +00:00
parent d605f09966
commit 691c400510

View File

@ -36,23 +36,15 @@ __FBSDID("$FreeBSD$");
__weak_reference(__swapcontext, swapcontext);
#warning "FIX __swapcontext on non i386 please!"
int
__swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
{
int ret;
#ifdef __i386__
/* XXX PLEASE FIX! XXX */
if ((oucp == NULL) ||
(oucp->uc_mcontext.mc_len != sizeof(mcontext_t)) ||
(ucp == NULL) ||
(ucp->uc_mcontext.mc_len != sizeof(mcontext_t))) {
if ((oucp == NULL) || (ucp == NULL)) {
errno = EINVAL;
return (-1);
}
#endif
oucp->uc_flags &= ~UCF_SWAPPED;
ret = getcontext(oucp);
if ((ret == 0) && !(oucp->uc_flags & UCF_SWAPPED)) {