Skip to content

Commit

Permalink
record limit for TLS 1.3 inner plaintext
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Dec 27, 2024
1 parent 1ae492c commit 4126d6a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tls/Network/TLS/Record/Disengage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ decryptRecord record@(Record ct ver fragment) = do
decryptData13 mver e st = case ct of
ProtocolType_AppData -> do
inner <- decryptData mver record e st
let len = B.length inner
when (len > 16385) $
throwError $
Error_Protocol
( "TLS 1.3 inner plaintext exceeding maximum size: "
++ show len
++ " > 16385 (2^14 + 1)"
)
RecordOverflow
case unInnerPlaintext inner of
Left message -> throwError $ Error_Protocol message UnexpectedMessage
Right (ct', d) -> return $ Record ct' ver (fragmentCompressed d)
Expand Down

0 comments on commit 4126d6a

Please sign in to comment.