aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeffro256 <jeffro256@tutanota.com>2025-07-11 10:39:00 -0500
committerjeffro256 <jeffro256@tutanota.com>2025-07-11 11:27:12 -0500
commit45152f9ef0a762d9f6b61fc2602b97a2085f2dc3 (patch)
treec9a75a9245c9646b42c5c4d540b8a6d8ffabbbad
parent3e218c2021a8346e8adb87baaadfb7261ae1477a (diff)
downloadmonzero-core-45152f9ef0a762d9f6b61fc2602b97a2085f2dc3.tar.gz
monzero-core-45152f9ef0a762d9f6b61fc2602b97a2085f2dc3.tar.xz
monzero-core-45152f9ef0a762d9f6b61fc2602b97a2085f2dc3.zip
rpc: return error correctly on bad key image string
Because of the missing `return` statement, the status is set to "OK" later on in the method when it shouldn't be. Thank you to ADA Logics and the MAGIC Monero Fund for reporting this!
-rw-r--r--src/rpc/core_rpc_server.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index f1ff59e96..5d8a700e2 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1240,8 +1240,11 @@ namespace cryptonote
if(b.size() != sizeof(crypto::key_image))
{
res.status = "Failed, size of data mismatch";
+ return true;
}
- key_images.push_back(*reinterpret_cast<const crypto::key_image*>(b.data()));
+ key_images.emplace_back();
+ crypto::key_image &ki = key_images.back();
+ memcpy(&ki, b.data(), sizeof(crypto::key_image));
}
std::vector<bool> spent_status;
bool r = m_core.are_key_images_spent(key_images, spent_status);