Skip to content

Commit f3e154b

Browse files
committed
ssl: use malloc instead of alloca
1 parent a682206 commit f3e154b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ssl/tls1.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header,
661661
const uint8_t *buf, int buf_len, uint8_t *hmac_buf)
662662
{
663663
int hmac_len = buf_len + 8 + SSL_RECORD_SIZE;
664-
uint8_t *t_buf = (uint8_t *)alloca(buf_len+100);
664+
uint8_t *t_buf = (uint8_t *)malloc(buf_len+100);
665665

666666
memcpy(t_buf, (mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_WRITE) ?
667667
ssl->write_sequence : ssl->read_sequence, 8);
@@ -673,6 +673,8 @@ static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header,
673673
ssl->server_mac : ssl->client_mac,
674674
ssl->cipher_info->digest_size, hmac_buf);
675675

676+
free(t_buf);
677+
676678
#if 0
677679
print_blob("record", hmac_header, SSL_RECORD_SIZE);
678680
print_blob("buf", buf, buf_len);

0 commit comments

Comments
 (0)