Skip to content

Commit

Permalink
tools: acrn-manager: fix a potential NULL pointer dereference
Browse files Browse the repository at this point in the history
check the return value of vmmngr_find() before dereference in wait_vm_stop()

Tracked-On: #1479
Signed-off-by: Yan, Like <like.yan@intel.com>
  • Loading branch information
lyan3 authored and wenlingz committed Oct 22, 2018
1 parent da3b027 commit e8c8656
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/acrn-manager/acrnctl.c
Expand Up @@ -504,8 +504,13 @@ static int wait_vm_stop(const char * vmname, unsigned int timeout)
vmmngr_update();

s = vmmngr_find(vmname);
if (s->state == VM_CREATED)
return 0;
if (s == NULL) {
printf("%s: vm %s not found\n", __func__, vmname);
return -1;
} else {
if (s->state == VM_CREATED)
return 0;
}

sleep(1);
} while (t--);
Expand Down

0 comments on commit e8c8656

Please sign in to comment.