From 21257091fbfa90231a32a8c1a5c71db36e9bdfab Mon Sep 17 00:00:00 2001 From: Andrii Shtompel Date: Wed, 5 Oct 2016 18:03:21 +0300 Subject: [PATCH] RC3 svace fix (cloudClient + crlresource.c) Change-Id: Ic6093286d89daf6de10ed617c445fbc53d8a3bd1 Signed-off-by: Andrii Shtompel Reviewed-on: https://gerrit.iotivity.org/gerrit/12829 Tested-by: jenkins-iotivity Reviewed-by: Randeep Singh --- .../csdk/security/provisioning/sample/cloud/cloudCommon.c | 11 +++++++---- resource/csdk/security/src/crlresource.c | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudCommon.c b/resource/csdk/security/provisioning/sample/cloud/cloudCommon.c index ec30045..e1dcc80 100644 --- a/resource/csdk/security/provisioning/sample/cloud/cloudCommon.c +++ b/resource/csdk/security/provisioning/sample/cloud/cloudCommon.c @@ -340,12 +340,15 @@ static OCStackResult saveTrustCert(void) res = OCSaveTrustCertChain(trustCertChainArray.data, trustCertChainArray.len, OIC_ENCODING_PEM,&g_credId); - if(OC_STACK_OK != res) + if (OC_STACK_OK != res) { - OIC_LOG(ERROR, TAG, "OCSaveTrustCertChainBin API error"); - return res; + OIC_LOG(ERROR, TAG, "OCSaveTrustCertChain API error"); + } + else + { + OIC_LOG_V(INFO, TAG, "CredId of Saved Trust Cert. Chain into Cred of SVR : %d.\n", g_credId); } - OIC_LOG_V(INFO, TAG, "CredId of Saved Trust Cert. Chain into Cred of SVR : %d.\n", g_credId); + OICFree(trustCertChainArray.data); return res; } diff --git a/resource/csdk/security/src/crlresource.c b/resource/csdk/security/src/crlresource.c index 46a82fb..12d4f0b 100644 --- a/resource/csdk/security/src/crlresource.c +++ b/resource/csdk/security/src/crlresource.c @@ -458,11 +458,16 @@ static void getCurrentUTCTime(char *out, size_t len) { //TODO: how to implement it in cross-platform way? time_t rawtime; - struct tm * timeinfo; + struct tm * timeinfo = NULL; time ( &rawtime ); timeinfo = localtime ( &rawtime ); + if (NULL == timeinfo) + { + return; + } + snprintf(out, len, "%04d%02d%02d%02d%02d%02d", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); -- 2.7.4