From: Kyle Hale Date: Thu, 23 Aug 2012 08:59:11 +0000 (-0500) Subject: check for out-of-bounds index when freeing a VM X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb863b147912e887585346534ada9070af48412f;p=palacios.git check for out-of-bounds index when freeing a VM --- diff --git a/linux_module/main.c b/linux_module/main.c index fdab7b3..17229c5 100644 --- a/linux_module/main.c +++ b/linux_module/main.c @@ -141,7 +141,14 @@ out_err: } case V3_FREE_GUEST: { unsigned long vm_idx = arg; - struct v3_guest * guest = guest_map[vm_idx]; + struct v3_guest * guest; + + if (vm_idx > MAX_VMS) { + ERROR("Invalid VM index: %ld\n", vm_idx); + return -1; + } + + guest = guest_map[vm_idx]; if (!guest) { ERROR("No VM at index %ld\n",vm_idx);