Add exception handling to StepSignature 25/280125/1
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 24 Aug 2022 07:06:17 +0000 (16:06 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Wed, 24 Aug 2022 07:06:17 +0000 (16:06 +0900)
If StepSignature's precheck fails, the variable 'signature_' is not initialized

Change-Id: Ie605111e8572e6d7ccf5e8e161fa5e6f29b13dee
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/common/step/security/step_signature.cc

index 6c7abdd..3a63882 100644 (file)
@@ -132,6 +132,9 @@ Step::Status StepSignature::process() {
 }
 
 Step::Status StepSignature::undo() {
+  if (signature_ == nullptr)
+    return Step::Status::OK;
+
   bf::remove(signature_->GetFilePath());
   if (bf::exists(signature_->GetBackupPath()))
     bf::rename(signature_->GetBackupPath(), signature_->GetFilePath());