diff --git a/utils/src/b_error/b_excep_utils.cpp b/utils/src/b_error/b_excep_utils.cpp index 5a6ad2f9144af3aab7ee88fa01b613989fcb2901..8abfd08e532f6c9222e6f365a5d17fdbc2a335ec 100644 --- a/utils/src/b_error/b_excep_utils.cpp +++ b/utils/src/b_error/b_excep_utils.cpp @@ -30,8 +30,8 @@ void BExcepUltils::VerifyPath(const string_view &path, bool isExtension) auto ret = canonicalize(path.data()); string absPath = ret.c_str(); if (isExtension && - absPath.find(string(BConstants::PATH_BUNDLE_BACKUP_HOME) - .append(BConstants::SA_BUNDLE_BACKUP_RESTORE)) == std::string::npos) { + !absPath.starts_with( + string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE))) { throw BError(BError::Codes::EXT_INVAL_ARG, "Invalid path, not in backup restore path"); } } catch (const rust::Error &e) {