dm: use strnlen to replace strlen

Tracked-On: #2133
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Shuo A Liu
2018-12-25 10:33:36 +08:00
committed by wenlingz
parent 3e0b06cfd6
commit b3ad44d4c1
14 changed files with 27 additions and 25 deletions

View File

@@ -93,7 +93,7 @@ vm_create(const char *name, uint64_t req_buf)
uuid_t vm_uuid;
memset(&create_vm, 0, sizeof(struct acrn_create_vm));
ctx = calloc(1, sizeof(struct vmctx) + strlen(name) + 1);
ctx = calloc(1, sizeof(struct vmctx) + strnlen(name, PATH_MAX) + 1);
assert(ctx != NULL);
assert(devfd == -1);