Fix prevent issues in FSecurity
[platform/framework/native/appfw.git] / src / security / FSec_DeviceKeyGenerator.cpp
index ff218cc..fdee420 100644 (file)
@@ -86,7 +86,8 @@ _DeviceKeyGenerator::GenerateDeviceKeyN(int keySize)
 
        pDeviceInfo = _StringConverter::CopyToCharArrayN(deviceInfo);
        deviceInfoBuffer.Construct(deviceInfo.GetLength());
-       deviceInfoBuffer.SetArray(reinterpret_cast <byte*>(pDeviceInfo), 0, deviceInfo.GetLength());
+       r = deviceInfoBuffer.SetArray(reinterpret_cast <byte*>(pDeviceInfo), 0, deviceInfo.GetLength());
+       SysTryCatch(NID_SEC, r == E_SUCCESS, , r, "[%s] A system error has occurred.", GetErrorMessage(r));
        deviceInfoBuffer.Flip();
        delete[] pDeviceInfo;
 
@@ -168,7 +169,8 @@ _DeviceKeyGenerator::GenerateDeviceKeyN(String& appId, int keySize)
 
        pDeviceInfo = _StringConverter::CopyToCharArrayN(deviceInfo);
        deviceInfoBuffer.Construct(deviceInfo.GetLength());
-       deviceInfoBuffer.SetArray(reinterpret_cast <byte*>(pDeviceInfo), 0, deviceInfo.GetLength());
+       r = deviceInfoBuffer.SetArray(reinterpret_cast <byte*>(pDeviceInfo), 0, deviceInfo.GetLength());
+       SysTryCatch(NID_SEC, r == E_SUCCESS, , r, "[%s] A system error has occurred.", GetErrorMessage(r));
        deviceInfoBuffer.Flip();
        delete[] pDeviceInfo;