replace strcpy with strncpy for fixing SVACE(WGID=411075,411076) 48/200348/1 accepted/tizen/unified/20190222.134051 submit/tizen/20190222.041951
authorDongsun Lee <ds73.lee@samsung.com>
Fri, 22 Feb 2019 04:15:36 +0000 (13:15 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Fri, 22 Feb 2019 04:15:36 +0000 (13:15 +0900)
Change-Id: I26207f412d5aeee68f6c90131d6c62978233c5f5
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
src/manager/service/key-provider.cpp

index e89af16..6049acb 100644 (file)
@@ -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);
 }