1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-15 00:02:49 +03:00

ssl: use malloc instead of alloca

This commit is contained in:
Ivan Grokhotkov
2016-08-25 12:46:51 +08:00
parent a682206523
commit f3e154b870

View File

@ -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);