From e087f909b3fcb5824556e52fe7d42cee0a647c89 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 3 Nov 2021 11:46:05 +0100 Subject: [PATCH] commands: return none, when offset exceeds file length The computed length of the file may be negative, when the offset exceeds the file length. When this is the case, return none Change-Id: I2c017c620254fae188022851ef3b670730aab503 --- pySim/commands.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pySim/commands.py b/pySim/commands.py index 107f0f58..cea330e7 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -155,6 +155,9 @@ class SimCardCommands(object): return (None, None) if length is None: length = self.__len(r) - offset + if length < 0: + return (None, None) + total_data = '' chunk_offset = 0 while chunk_offset < length: