}
memset(vm->name, 0, 128);
- strncpy(vm->name, name, 127);
+ strncpy(vm->name, name, 128);
+ vm->name[127] = 0;
+
if(v3_cpu_mapper_register_vm(vm) == -1) {
}
// Note, assumes virtual contiguity in the host OS...
+ // A null deref here can only happen if the host does not provide the
+ // physical_to_virtual functions or if they do not work
memcpy(V3_VAddr((void*)new_hpa), V3_VAddr((void*)(reg->host_addr)), num_pages*PAGE_SIZE);
old_hpa = (void*)(reg->host_addr);
#endif
-void v3_print_cond(const char * fmt, ...) {
- if (v3_dbg_enable == 1) {
- char buf[2048];
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(buf, 2048, fmt, ap);
- va_end(ap);
-
- V3_Print(VM_NONE, VCORE_NONE,"%s", buf);
- }
-}