Fix out-of-bounds array access in tests-mbedmicro-rtos-mbed-malloc

pull/11023/head
Neil Tuttle 2019-06-24 16:27:10 -07:00 committed by Evelyne Donnaes
parent 1348db5af7
commit 5233eeae5b
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ void test_alloc_and_free(void)
int size = SIZE_INCREMENTS; int size = SIZE_INCREMENTS;
int loop = ALLOC_LOOP; int loop = ALLOC_LOOP;
while (loop) { while (loop) {
data = malloc(size); data = count < ALLOC_ARRAY_SIZE ? malloc(size) : NULL;
if (NULL != data) { if (NULL != data) {
array[count++] = data; array[count++] = data;
memset((void *)data, 0xdeadbeef, size); memset((void *)data, 0xdeadbeef, size);