From f28e225459f7b1e756f31563431674c949767bc7 Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Wed, 17 Apr 2013 14:51:43 +0900 Subject: [PATCH 1/1] Fixed crash during saving certificate. [Issue#] N/A [Problem] fail during saving certificate. [Cause] there is bug at set certificate. [Solution] null check during set certificate. [SCMRequest] N/A Change-Id: I06e7dbb47dd7040ba416114ba3e2e1a3edc9668a --- src/jobs/widget_install/task_certificates.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/jobs/widget_install/task_certificates.cpp b/src/jobs/widget_install/task_certificates.cpp index 04247fa..a6693bc 100644 --- a/src/jobs/widget_install/task_certificates.cpp +++ b/src/jobs/widget_install/task_certificates.cpp @@ -91,6 +91,7 @@ void TaskCertificates::SetCertiInfo(CertificateSource source) LogDebug("Insert certinfo to pkgmgr structure"); ValidationCore::CertificateCollection chain; + if (false == chain.load(*it)) { LogError("Chain is broken"); ThrowMsg(Exceptions::SetCertificateInfoFailed, @@ -108,11 +109,17 @@ void TaskCertificates::SetCertiInfo(CertificateSource source) pkgmgr_instcert_type instCertType; if (source == SIGNATURE_DISTRIBUTOR) { - std::string - Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName())); - size_t found = Name.find("Tizen"); + bool distributor1 = false; + if (!(*certIt)->getCommonName().IsNull()) { + std::string + Name(DPL::ToUTF8String(*(*certIt)->getCommonName())); + std::string tizenStr("Tizen"); + if (0 == Name.compare(0, tizenStr.length(), tizenStr)) { + distributor1 = true; + } + } - if (found != std::string::npos) { + if (distributor1) { LogDebug("Set SIGNATURE_DISTRIBUTOR"); if ((*certIt)->isRootCert()) { instCertType = PM_SET_DISTRIBUTOR_ROOT_CERT; -- 2.7.4