Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8163251: Hard coded loop limit prevents reading of smart card data gr…
…eater than 8k
Reviewed-by: valeriep, rriggs
- Loading branch information
|
|
@@ -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 @@ private static boolean getBooleanProperty(String name, boolean def) { |
|
|
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 @@ private static boolean getBooleanProperty(String name, boolean def) { |
|
|
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); |
|
|