Skip to content

Commit 93f7ed1

Browse files
Fix the build when MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is undefined
Signed-off-by: Gilles Peskine <[email protected]>
1 parent 5a38d1a commit 93f7ed1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/ssl_msg.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,14 +3116,19 @@ int mbedtls_ssl_prepare_handshake_record(mbedtls_ssl_context *ssl)
31163116
* after the explicit IV, but here we move it to start where the
31173117
* IV was.
31183118
*/
3119-
if (payload_end + ssl->in_hsfraglen > ssl->in_buf + ssl->in_buf_len) {
3119+
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
3120+
size_t const in_buf_len = ssl->in_buf_len;
3121+
#else
3122+
size_t const in_buf_len = MBEDTLS_SSL_IN_BUFFER_LEN;
3123+
#endif
3124+
if (payload_end + ssl->in_hsfraglen > ssl->in_buf + in_buf_len) {
31203125
MBEDTLS_SSL_DEBUG_MSG(1,
31213126
("Shouldn't happen: no room to move handshake fragment %"
31223127
MBEDTLS_PRINTF_SIZET " from %p to %p (buf=%p len=%"
31233128
MBEDTLS_PRINTF_SIZET ")",
31243129
ssl->in_msglen,
31253130
ssl->in_msg, payload_end,
3126-
ssl->in_buf, ssl->in_buf_len));
3131+
ssl->in_buf, in_buf_len));
31273132
return MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
31283133
}
31293134
memmove(payload_end, ssl->in_msg, ssl->in_msglen);

0 commit comments

Comments
 (0)