Skip to content

Commit 7d6b0ac

Browse files
committed
Guard AEAD buffer growth overflow
F/007
1 parent 8cf6e69 commit 7d6b0ac

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/psa_aead.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ static psa_status_t wolfpsa_aead_append(uint8_t **buf, size_t *len,
7272
if (data_length == 0) {
7373
return PSA_SUCCESS;
7474
}
75+
if (*len > SIZE_MAX - data_length) {
76+
return PSA_ERROR_INSUFFICIENT_MEMORY;
77+
}
7578

7679
new_buf = (uint8_t *)XMALLOC(*len + data_length, NULL,
7780
DYNAMIC_TYPE_TMP_BUFFER);

0 commit comments

Comments
 (0)