OC_RSRVD_ES_URI_EASYSETUP, OCEntityHandlerCb,
NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
}
- if(res)
+ if(res != OC_STACK_OK)
{
OIC_LOG_V(INFO, ES_RH_TAG, "Created EasySetup resource with result: %s", getResult(res));
return res;
}
res = OCBindResourceTypeToResource(g_ESEasySetupResource.handle, OC_RSRVD_ES_RES_TYPE_COL);
- if(res)
+ if(res != OC_STACK_OK)
{
OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource type with result: %s", getResult(res));
return res;
}
res = OCBindResourceInterfaceToResource(g_ESEasySetupResource.handle, OC_RSRVD_INTERFACE_LL);
- if(res)
+ if(res != OC_STACK_OK)
{
OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource interface with result: %s", getResult(res));
return res;
}
res = OCBindResourceInterfaceToResource(g_ESEasySetupResource.handle, OC_RSRVD_INTERFACE_BATCH);
- if(res)
+ if(res != OC_STACK_OK)
{
OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource interface with result: %s", getResult(res));
return res;
bool ret = false;
std::string ownerID;
- char uuidString[UUID_STRING_SIZE];
+ char uuidString[UUID_STRING_SIZE] = {};
if(OCConvertUuidToString(foundDevice->getDevPtr()->doxm->owner.id, uuidString))
{
ownerID = uuidString;
}
else if(OC_STACK_AUTHENTICATION_FAILURE == result->at(i).res)
{
- OicSecOxm_t oxm;
+ OicSecOxm_t oxm = OIC_OXM_COUNT;
if(OC_STACK_OK != m_securedResource->getOTMethod(&oxm))
{
OTMResult = false;
OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "SID: %s", m_securedResource->getDeviceID().c_str());
OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Owned status: %d", m_securedResource->getOwnedStatus());
- OicSecOxm_t selectedOTMethod;
+ OicSecOxm_t selectedOTMethod = OIC_OXM_COUNT;
if( OC_STACK_OK != m_securedResource->getOTMethod(&selectedOTMethod) )
{
selectedOTMethod = OIC_OXM_COUNT; // Out-of-range
#endif
if(m_securedResource->getOwnedStatus())
{
- char uuidString[UUID_STRING_SIZE];
+ char uuidString[UUID_STRING_SIZE] = {};
if(OCConvertUuidToString(m_securedResource->getDevPtr()->doxm->owner.id, uuidString))
{
OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Owner ID: %s", uuidString);
return {};
}
- char uuidString[UUID_STRING_SIZE];
+ char uuidString[UUID_STRING_SIZE] = {};
if(OCConvertUuidToString(mediatorDevId->id, uuidString))
{
OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Mediator UUID : %s", uuidString);
if (OC_STACK_OK != res)
{
OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Error while getting info from DB");
+ OICFree(uuidList);
return false;
}
// Need to discover Owned device in a given network, again
std::shared_ptr< OC::OCSecureResource > ownedDevice = NULL;
- OCStackResult result;
+ OCStackResult result = OC_STACK_ERROR;
OicUuid_t uuid;
if(OC_STACK_OK != ConvertStrToUuid(m_ocResource->sid().c_str(), &uuid))
{
// Set user properties if needed
char userValue_str[] = "user_str";
g_userProperties.userValue_int = 0;
- strcpy(g_userProperties.userValue_str, userValue_str);
+
+ strncpy(g_userProperties.userValue_str, userValue_str, strlen(userValue_str));
SetUserProperties(&g_userProperties);
if(ESSetDeviceProperty(&deviceProperty) == ES_ERROR)
printf("EasySetup Enrollee SAMPLE\n");
printf("#########################\n");
PrintMenu();
- char option;
+ char option = "";
while(true)
{
PrintMenu();
break;
}
- if (option == 'Q' || option == 'q') { break; }
+ if (option == 'Q' || option == 'q')
+ {
+ break;
+ }
}
}
return 0;