Skip to content

Commit

Permalink
Update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 22, 2024
1 parent 42744fc commit 5155a2d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cpp/s2pexec/s2pexec_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ string S2pExec::ExecuteCommand()
}
catch (const parser_exception&)
{
return "Error: Invalid CDB: '" + command + "'";
return "Error: Invalid CDB data input format: '" + command + "'";
}

vector<uint8_t> cdb;
Expand Down Expand Up @@ -417,7 +417,15 @@ string S2pExec::ReadData()
stringstream ss;
ss << in.rdbuf();
if (!in.fail()) {
for (const byte b : HexToBytes(ss.str())) {
vector<byte> bytes;
try {
bytes = HexToBytes(ss.str());
}
catch (const parser_exception&) {
return "Invalid command data input data format";
}

for (const byte b : bytes) {
buffer.emplace_back(static_cast<uint8_t>(b));
}
}
Expand Down

0 comments on commit 5155a2d

Please sign in to comment.