Skip to content

Commit

Permalink
Fix IndexError on junk message.
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Perrin committed Aug 5, 2015
1 parent 496980f commit aca8d4f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tlslite/tlsrecordlayer.py
Expand Up @@ -970,6 +970,12 @@ def _decryptRecord(self, recordType, b):
if self.version >= (3,2): #For TLS 1.1, remove explicit IV
b = b[self._readState.encContext.block_size : ]

if len(b) == 0:
for result in self._sendError(\
AlertDescription.decryption_failed,
"No data left after decryption and IV removal"):
yield result

#Check padding
paddingGood = True
paddingLength = b[-1]
Expand Down

0 comments on commit aca8d4f

Please sign in to comment.