diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-01-19 13:02:47 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-04 22:38:06 +0000 |
commit | 23abe60705a7b1040d177478a3ff1403d1fe0ef4 (patch) | |
tree | 8a7361e525f9e7e45bb04e4f252fd9a1c430d0a7 /src/wallet/message_transporter.cpp | |
parent | default initialize rpc structures (diff) | |
download | monero-23abe60705a7b1040d177478a3ff1403d1fe0ef4.tar.xz |
check load_t_from_json return values
Diffstat (limited to '')
-rw-r--r-- | src/wallet/message_transporter.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/wallet/message_transporter.cpp b/src/wallet/message_transporter.cpp index 19bfa074d..2f8188a3c 100644 --- a/src/wallet/message_transporter.cpp +++ b/src/wallet/message_transporter.cpp @@ -118,7 +118,11 @@ bool message_transporter::receive_messages(const std::vector<std::string> &desti std::string json = get_str_between_tags(answer, "<string>", "</string>"); bitmessage_rpc::inbox_messages_response bitmessage_res; - epee::serialization::load_t_from_json(bitmessage_res, json); + if (!epee::serialization::load_t_from_json(bitmessage_res, json)) + { + MERROR("Failed to deserialize messages"); + return true; + } size_t size = bitmessage_res.inboxMessages.size(); messages.clear(); @@ -140,8 +144,10 @@ bool message_transporter::receive_messages(const std::vector<std::string> &desti std::string message_body = epee::string_encoding::base64_decode(message_info.message); // Second Base64-decoding: The MMS uses Base64 to hide non-textual data in its JSON from Bitmessage json = epee::string_encoding::base64_decode(message_body); - epee::serialization::load_t_from_json(message, json); - is_mms_message = true; + if (!epee::serialization::load_t_from_json(message, json)) + MERROR("Failed to deserialize message"); + else + is_mms_message = true; } catch(const std::exception& e) { |