int main()
{
OCStackResult res = OC_STACK_OK;
+ OCProvisionDev_t* pDeviceList = NULL;
+ OCProvisionDev_t *pOwnedList = NULL;
// Initialize Persistent Storage for SVR database
OCPersistentStorage ps = { .open = client_fopen,
goto error;
}
- OCProvisionDev_t* pDeviceList = NULL;
res = OCDiscoverUnownedDevices(PREDEFINED_TIMEOUT, &pDeviceList);
if(OC_STACK_OK != res)
{
// Credential & ACL provisioning between two devices.
- OCProvisionDev_t *pOwnedList = NULL;
OCProvisionDev_t *pOwnedDevices [MAX_OWNED_DEVICE] = {0,};
int nOwnedDevice = 0;
certificate->tbsCertificate.subjectPublicKeyInfo.subjectPublicKey.buf = NULL;
certificate->tbsCertificate.signature.algorithm.buf = NULL;
certificate->tbsCertificate.subjectPublicKeyInfo.algorithm.algorithm.buf = NULL;
- certificate->tbsCertificate.subjectPublicKeyInfo.algorithm.id_ecPublicKey->buf = NULL;
+ if (certificate->tbsCertificate.subjectPublicKeyInfo.algorithm.id_ecPublicKey)
+ {
+ certificate->tbsCertificate.subjectPublicKeyInfo.algorithm.id_ecPublicKey->buf = NULL;
+ }
certificate->signatureAlgorithm.algorithm.buf = NULL;
}
ASN_STRUCT_FREE(asn_DEF_Certificate, certificate);
FUNCTION_CLEAR(
OICFree(subjectName);
- OICFree(subjectPublicKey->buf);
OICFree(subjectPublicKey);
- OICFree(subjectPrivateKey->buf);
- OICFree(subjectPrivateKey);
+ if (subjectPrivateKey)
+ {
+ OICFree(subjectPrivateKey->buf);
+ OICFree(subjectPrivateKey);
+ }
);
}
size_t offset = strlen(firstPart);
for (size_t i = 0; i < chainLength; ++i)
{
- offset += snprintf(certPubJWK + offset, certPubJWKLen, "\"%s\",", certificateChain[i]);
+ offset += snprintf(certPubJWK + offset, certPubJWKLen - offset, "\"%s\",", certificateChain[i]);
}
- sprintf(certPubJWK + offset - 1, secondPart);
+ snprintf(certPubJWK + offset - 1, certPubJWK - offset - 1, secondPart);
}
else
{