Skip to content

Commit

Permalink
Fix string overflow, when meta was read without error, but without cl…
Browse files Browse the repository at this point in the history
…osing

brackets
  • Loading branch information
fvacek committed Sep 18, 2024
1 parent 4502bb1 commit 4b10bee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libshviotqt/src/rpc/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ int FrameReader::tryToReadMeta(std::istringstream &in)
try {
m_meta = {};
rd.read(m_meta);
m_dataStart = static_cast<size_t>(in.tellg());
auto data_start = in.tellg();
if (data_start == -1) {
// meta was read without error, but without closing brackets
return 0;
}
m_dataStart = static_cast<size_t>(data_start);
if (chainpack::RpcMessage::isResponse(m_meta)) {
if (auto rqid = chainpack::RpcMessage::requestId(m_meta).toInt(); rqid > 0) {
return rqid;
Expand Down

0 comments on commit 4b10bee

Please sign in to comment.