summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/vmd/vm.c5
-rw-r--r--usr.sbin/vmd/vmd.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c
index 2b2acac51fd..dd3915ae726 100644
--- a/usr.sbin/vmd/vm.c
+++ b/usr.sbin/vmd/vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm.c,v 1.46 2019/05/11 19:55:14 jasper Exp $ */
+/* $OpenBSD: vm.c,v 1.47 2019/05/11 19:59:32 jasper Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -585,6 +585,9 @@ dump_send_header(int fd) {
struct vm_dump_header vmh;
int i;
+ memcpy(&vmh.vmh_signature, VM_DUMP_SIGNATURE,
+ sizeof(vmh.vmh_signature));
+
vmh.vmh_cpuids[0].code = 0x00;
vmh.vmh_cpuids[0].leaf = 0x00;
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 5e86a4c6d93..197566df4ef 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.110 2019/05/11 19:55:14 jasper Exp $ */
+/* $OpenBSD: vmd.c,v 1.111 2019/05/11 19:59:32 jasper Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -553,6 +553,10 @@ vmd_check_vmh(struct vm_dump_header *vmh)
unsigned int code, leaf;
unsigned int a, b, c, d;
+ if (strncmp(vmh->vmh_signature, VM_DUMP_SIGNATURE, strlen(VM_DUMP_SIGNATURE)) != 0) {
+ log_warnx("%s: incompatible dump signature", __func__);
+ return (-1);
+ }
if (vmh->vmh_version != VM_DUMP_VERSION) {
log_warnx("%s: incompatible dump version", __func__);