[Archive] Fixed Coverity issue 52/255852/2
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Wed, 24 Mar 2021 08:09:17 +0000 (09:09 +0100)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Wed, 24 Mar 2021 08:38:24 +0000 (09:38 +0100)
Issue id: 1218132

[Verification]
  Code compiles, TCT passrate 100%.
  Coverity showed no issues:
   https://analysishub.sec.samsung.net/service/analyses/418348

Change-Id: I5d28891a7b2c3b42237c661474ea88d00e028184

src/archive/archive_utils.cc

index ec6b564..f54162b 100644 (file)
@@ -271,7 +271,7 @@ bool pathTargetsDirectoryOutsideDestination(const std::string& targetEntryPath,
 
   std::string normalizedPath = normalizePath(destinationPath, targetEntryPath);
 
-  if (!normalizedPath.rfind(destinationPath, 0) == 0) {
+  if (normalizedPath.rfind(destinationPath, 0) != 0) {
     LoggerE("Destination outside of allowed directory: %s", normalizedPath.c_str());
     return true;
   }