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
This commit is contained in:
Philipp Maier
2021-11-03 11:46:05 +01:00
committed by dexter
parent 712251a6e0
commit e087f909b3

View File

@@ -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: