libxc/restore: Fix data auditing in handle_x86_pv_vcpu_blob()

The current logic only works by chance, in that XSAVE records also tend to be
a multiple of 128.  Implement the missing logic for XSAVE.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Andrew Cooper committed 2019-12-20 12:12:00 +00:00
1 parent aafae0e800
commit 2a62c22715
1 file changed
+9
+9
View File
@@ -825,6 +825,15 @@ static int handle_x86_pv_vcpu_blob(struct xc_sr_context *ctx,
break;
case REC_TYPE_X86_PV_VCPU_XSAVE:
if ( blobsz < 128 )
{
ERROR("%s record too short: min %zu, got %u",
rec_name, sizeof(*vhdr) + 128, rec->length);
goto out;
}
break;
case REC_TYPE_X86_PV_VCPU_MSRS:
if ( blobsz % sizeof(xen_domctl_vcpu_msr_t) != 0 )
{
ERROR("%s record payload size %zu expected to be a multiple of %zu",
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.