From f3e154b870961a2f5ad665d1999eeffc868244be Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 25 Aug 2016 12:46:51 +0800 Subject: [PATCH] ssl: use malloc instead of alloca --- ssl/tls1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssl/tls1.c b/ssl/tls1.c index c40a0691f..c9615de1c 100644 --- a/ssl/tls1.c +++ b/ssl/tls1.c @@ -661,7 +661,7 @@ static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header, const uint8_t *buf, int buf_len, uint8_t *hmac_buf) { int hmac_len = buf_len + 8 + SSL_RECORD_SIZE; - uint8_t *t_buf = (uint8_t *)alloca(buf_len+100); + uint8_t *t_buf = (uint8_t *)malloc(buf_len+100); memcpy(t_buf, (mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_WRITE) ? ssl->write_sequence : ssl->read_sequence, 8); @@ -673,6 +673,8 @@ static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header, ssl->server_mac : ssl->client_mac, ssl->cipher_info->digest_size, hmac_buf); + free(t_buf); + #if 0 print_blob("record", hmac_header, SSL_RECORD_SIZE); print_blob("buf", buf, buf_len);