Additional error handling for rarer states.

Ensure std::map::at is not blindly applied without checking that the key
actually exists.

Fixes crashes where u2f client on PC/browser expects channel open, but
service has been restarted.
This commit is contained in:
2019-09-08 20:27:47 +01:00
parent f8d077634e
commit 89b4b7d949
4 changed files with 20 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ void U2F_Authenticate_APDU::respond(const uint32_t channelID) const {
if (Storage::appParams.find(keyHB) == Storage::appParams.end()) {
// Respond with error code - key handle doesn't exist in storage
cerr << "Invalid key handle" << endl;
this->error(channelID, SW_WRONG_DATA);
this->error(channelID, APDU_STATUS::SW_WRONG_DATA);
return;
}