mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 01:54:44 +00:00
tools: acrnctl restrict length of vmname to 32 bytes
When run 'acrnctl add launch_script.sh', vmname will be detected from the launch script and stored in vmmngr_struct.name[MAX_VM_OS_NAME_LEN], so vmname should not be longer than MAX_VM_OS_NAME_LEN. Tracked-On: #2851 Signed-off-by: Tao Yuhong <yuhong.tao@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
committed by
wenlingz
parent
8109c2e94c
commit
b2f2d95246
@@ -85,6 +85,11 @@ static int check_name(const char *name)
|
||||
if (!strcmp(name, "nothing"))
|
||||
return -1;
|
||||
|
||||
if (strnlen(name, MAX_VM_OS_NAME_LEN) >= MAX_VM_OS_NAME_LEN) {
|
||||
printf("(%s) size exceed MAX_VM_OS_NAME_LEN:%u\n", name,MAX_VM_OS_NAME_LEN);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user