From a22e8727811e6b4adfbd24659f58594ba11fb00c Mon Sep 17 00:00:00 2001 From: Dongsun Lee Date: Fri, 22 Feb 2019 13:15:36 +0900 Subject: replace strcpy with strncpy for fixing SVACE(WGID=411075,411076) Change-Id: I26207f412d5aeee68f6c90131d6c62978233c5f5 Signed-off-by: Dongsun Lee --- src/manager/service/key-provider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/manager/service/key-provider.cpp b/src/manager/service/key-provider.cpp index e89af167..6049acb7 100644 --- a/src/manager/service/key-provider.cpp +++ b/src/manager/service/key-provider.cpp @@ -249,7 +249,7 @@ void WrappedKeyAndInfoContainer::setKeyInfoClient(const std::string resized_clie ThrowErr(Exc::InternalError, "Client name too long"); } - strcpy(wrappedKeyAndInfo.keyInfo.client, resized_client.c_str()); + strncpy(wrappedKeyAndInfo.keyInfo.client, resized_client.c_str(), resized_client.size()); } void WrappedKeyAndInfoContainer::setKeyInfoSalt(const unsigned char *salt, @@ -486,7 +486,7 @@ RawBuffer KeyProvider::generateDomainKEK( if (user.size() >= sizeof(domainKEK.getKeyAndInfo().keyInfo.client)) { ThrowErr(Exc::InternalError, "Client name too long"); } - strcpy(domainKEK.getKeyAndInfo().keyInfo.client, user.c_str()); + strncpy(domainKEK.getKeyAndInfo().keyInfo.client, user.c_str(), user.size()); return wrapDomainKEK(domainKEK, userPassword); } -- cgit v1.2.3