Skip to content

Commit 5907042

Browse files
author
Mika Tervonen
committed
Added check for allocation failures in EAPOL
1 parent 9ed97c9 commit 5907042

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ static int8_t supp_eap_tls_sec_prot_message_send(sec_prot_t *prot, uint8_t eap_c
244244
const uint8_t identity_size = sizeof(identity) - 1;
245245
if (data->tls_send.total_len != identity_size) {
246246
eap_tls_sec_prot_lib_message_allocate(&data->tls_send, TLS_HEAD_LEN, identity_size);
247+
if (!data->tls_send.data) {
248+
return -1;
249+
}
247250
memcpy(data->tls_send.data + TLS_HEAD_LEN, identity, identity_size);
248251
}
249252
flags = 0xff;

source/Security/protocols/tls_sec_prot/tls_sec_prot.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ static int16_t tls_sec_prot_tls_send(void *handle, const void *buf, size_t len)
496496
if (!data->tls_send.data) {
497497
eap_tls_sec_prot_lib_message_allocate(&data->tls_send, prot->header_size, TLS_SEC_PROT_BUFFER_SIZE);
498498
}
499+
if (!data->tls_send.data) {
500+
return -1;
501+
}
499502

500503
memcpy(data->tls_send.data + prot->header_size + data->tls_send.handled_len, buf, len);
501504
data->tls_send.handled_len += len;

0 commit comments

Comments
 (0)