aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cards/building_blocks.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cards/building_blocks.py b/cards/building_blocks.py
index 070ae67..7edc395 100644
--- a/cards/building_blocks.py
+++ b/cards/building_blocks.py
@@ -107,6 +107,7 @@ class Card_with_read_binary:
contents = ""
had_one = False
+ self.last_size = -1
while True:
command = C_APDU(self.APDU_READ_BINARY, p1 = offset >> 8, p2 = (offset & 0xff))
result = self.send_apdu(command)
@@ -114,6 +115,11 @@ class Card_with_read_binary:
contents = contents + result.data
offset = offset + (len(result.data) / self.DATA_UNIT_SIZE)
+ if self.last_size == len(contents):
+ break
+ else:
+ self.last_size = len(contents)
+
if not self.check_sw(result.sw):
break
else: