From b0457db54d49b8241e1b80438f98d118046b41c3 Mon Sep 17 00:00:00 2001 From: Nicolas Jager <nicolas.jager@savoirfairelinux.com> Date: Fri, 27 Jan 2017 10:16:37 -0500 Subject: [PATCH] fix : unhandled exception - if a wrong password is passed to readArchive() an exception is thrown by aesDecrypt(). Change-Id: I500822126a9dfea1b70963b9e2cb7441ce73db22 Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> --- src/ringdht/ringaccount.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index abd4bea70b..ffa70f13eb 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -904,7 +904,13 @@ RingAccount::readArchive(const std::string& pwd) const std::vector<uint8_t> file = fileutils::loadFile(archivePath_); // Decrypt - file = dht::crypto::aesDecrypt(file, pwd); + try { + file = dht::crypto::aesDecrypt(file, pwd); + } + catch (const std::exception& e) { + RING_ERR("Error decrypting archive: %s", e.what()); + return RingAccount::ArchiveContent(); + } // Load return loadArchive(file); -- GitLab