Skip to content

Commit 45152f9

Browse files
committed
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!
1 parent 3e218c2 commit 45152f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/rpc/core_rpc_server.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,8 +1240,11 @@ namespace cryptonote
12401240
if(b.size() != sizeof(crypto::key_image))
12411241
{
12421242
res.status = "Failed, size of data mismatch";
1243+
return true;
12431244
}
1244-
key_images.push_back(*reinterpret_cast<const crypto::key_image*>(b.data()));
1245+
key_images.emplace_back();
1246+
crypto::key_image &ki = key_images.back();
1247+
memcpy(&ki, b.data(), sizeof(crypto::key_image));
12451248
}
12461249
std::vector<bool> spent_status;
12471250
bool r = m_core.are_key_images_spent(key_images, spent_status);

0 commit comments

Comments
 (0)