Skip to content

Commit 1200efd

Browse files
committed
internal: GetRecordSize: precise header computation on fallback path
1 parent 75e7d5e commit 1200efd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/internal.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41820,19 +41820,18 @@ int wolfSSL_GetRecordSize(WOLFSSL *ssl, int payloadSz, int isEncrypted)
4182041820
0, 1, 0, CUR_ORDER);
4182141821
/* use a safe upper bound in case of error */
4182241822
if (recordSz < 0) {
41823-
recordSz = payloadSz + DTLS_RECORD_HEADER_SZ
41823+
recordSz = payloadSz + RECORD_HEADER_SZ
4182441824
+ cipherExtraData(ssl) + COMP_EXTRA;
41825+
if (ssl->options.dtls) {
41826+
recordSz += DTLS_RECORD_EXTRA;
41827+
}
4182541828
}
4182641829
}
4182741830
else {
41828-
recordSz = payloadSz;
41831+
recordSz = payloadSz + RECORD_HEADER_SZ;
4182941832
if (ssl->options.dtls) {
41830-
recordSz += DTLS_RECORD_HEADER_SZ;
41833+
recordSz += DTLS_RECORD_EXTRA;
4183141834
}
41832-
else {
41833-
recordSz += RECORD_HEADER_SZ;
41834-
}
41835-
4183641835
}
4183741836
return recordSz;
4183841837
}

0 commit comments

Comments
 (0)