bdev: Remove all uses of strncpy

strncpy is going to be added to the list of banned
functions because it does not guarantee strings are
null terminated.

Change-Id: I6657471f5771489b5004e48d08e79cebb860b069
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/407019
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ben Walker 2018-04-09 16:05:26 -07:00 committed by Daniel Verkamp
parent a615ae7e26
commit 7b822323e8

View File

@ -234,7 +234,7 @@ vbdev_lvs_create(struct spdk_bdev *base_bdev, const char *name, uint32_t cluster
SPDK_ERRLOG("name must be between 1 and %d characters\n", SPDK_LVS_NAME_MAX - 1);
return -EINVAL;
}
strncpy(opts.name, name, sizeof(opts.name));
snprintf(opts.name, sizeof(opts.name), "%s", name);
lvs_req = calloc(1, sizeof(*lvs_req));
if (!lvs_req) {