test/unit: replace sprintf call with snprintf call.

This fixes a Klocwork bug.

Change-Id: Ia42bf0f246c8e1b9aa211095a00b9d1ab8e7a085
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/396059
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2018-01-23 14:48:28 -07:00 committed by Jim Harris
parent f570aa654a
commit 68b96260ed

View File

@ -149,7 +149,7 @@ test_parse_capacity(void)
CU_ASSERT(cap == 472);
CU_ASSERT(has_prefix == false);
sprintf(str, "%"PRIu64, UINT64_MAX);
snprintf(str, sizeof(str), "%"PRIu64, UINT64_MAX);
rc = spdk_parse_capacity(str, &cap, &has_prefix);
CU_ASSERT(rc == 0);
CU_ASSERT(cap == UINT64_MAX);