8163251: Hard coded loop limit prevents reading of smart card data greater than 8k
Reviewed-by: valeriep, rriggs
This commit is contained in:
parent
5d9c59f2f8
commit
8aff5bda80
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -150,6 +150,7 @@ final class ChannelImpl extends CardChannel {
|
||||
return res;
|
||||
}
|
||||
|
||||
private final static int RESPONSE_ITERATIONS = 256;
|
||||
private final static byte[] B0 = new byte[0];
|
||||
|
||||
private byte[] doTransmit(byte[] command) throws CardException {
|
||||
@ -182,8 +183,9 @@ final class ChannelImpl extends CardChannel {
|
||||
int k = 0;
|
||||
byte[] result = B0;
|
||||
while (true) {
|
||||
if (++k >= 32) {
|
||||
throw new CardException("Could not obtain response");
|
||||
if (++k > RESPONSE_ITERATIONS) {
|
||||
throw new CardException("Number of response iterations" +
|
||||
" exceeded maximum " + RESPONSE_ITERATIONS);
|
||||
}
|
||||
byte[] response = SCardTransmit
|
||||
(card.cardId, card.protocol, command, 0, n);
|
||||
|
Loading…
Reference in New Issue
Block a user