Skip to content

Commit cd4283e

Browse files
author
Arto Kinnunen
authored
Merge pull request ARMmbed#10977 from vmedcy/tests-mbedmicro-rtos-mbed-malloc
Fix out-of-bounds array access in tests-mbedmicro-rtos-mbed-malloc
2 parents 1264660 + 81f8529 commit cd4283e

File tree

1 file changed

+1
-1
lines changed
  • TESTS/mbedmicro-rtos-mbed/malloc

1 file changed

+1
-1
lines changed

TESTS/mbedmicro-rtos-mbed/malloc/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void test_alloc_and_free(void)
122122
int size = SIZE_INCREMENTS;
123123
int loop = ALLOC_LOOP;
124124
while (loop) {
125-
data = malloc(size);
125+
data = count < ALLOC_ARRAY_SIZE ? malloc(size) : NULL;
126126
if (NULL != data) {
127127
array[count++] = data;
128128
memset((void *)data, 0xdeadbeef, size);

0 commit comments

Comments
 (0)