Ensure that the supplied data length is large enough to hold the base

FPU state to avoid passing a negative length to fpusetregs() / npxsetregs().

Differential Revision:	https://reviews.freebsd.org/D1861
Reviewed by:	kib, emaste
This commit is contained in:
John Baldwin 2015-02-18 23:34:03 +00:00
parent 9c633deb70
commit 8935302fe1
2 changed files with 4 additions and 2 deletions

View File

@ -88,7 +88,8 @@ cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data)
break;
case PT_SETXSTATE:
if (data > cpu_max_ext_state_size) {
if (data < sizeof(struct savefpu) ||
data > cpu_max_ext_state_size) {
error = EINVAL;
break;
}

View File

@ -92,7 +92,8 @@ cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data)
break;
case PT_SETXSTATE:
if (data > cpu_max_ext_state_size) {
if (data < sizeof(union savefpu) ||
data > cpu_max_ext_state_size) {
error = EINVAL;
break;
}