Skip to content

Commit 985d8eb

Browse files
committed
Fix off-by-one
1 parent 52050d8 commit 985d8eb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/us/q3q/fido2/FIDO2Applet.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ private void makeCredential(APDU apdu, short lc, byte[] buffer) {
725725
} else if (buffer[readIdx] != (byte) 0xF5) {
726726
sendErrorByte(apdu, FIDOConstants.CTAP2_ERR_CBOR_UNEXPECTED_TYPE);
727727
}
728+
readIdx++;
728729
largeBlobKeyRequested = true;
729730
} else {
730731
readIdx += sLen;
@@ -1906,6 +1907,9 @@ private void getAssertion(final APDU apdu, final short lc, final byte[] buffer,
19061907
// We've got a case of hmac-secret extension params!
19071908
// store the index and revisit it later, when we've handled the PIN protocol
19081909
hmacSecretReadIdx = readIdx;
1910+
if ((buffer[readIdx] & 0xF0) != 0xA0) {
1911+
sendErrorByte(apdu, FIDOConstants.CTAP2_ERR_CBOR_UNEXPECTED_TYPE);
1912+
}
19091913
readIdx = consumeAnyEntity(apdu, buffer, readIdx, lc);
19101914
}
19111915

0 commit comments

Comments
 (0)