Skip to content

Commit 81f8529

Browse files
cypress-neilvmedcy
authored andcommitted
Fix out-of-bounds array access in tests-mbedmicro-rtos-mbed-malloc
1 parent a415dfa commit 81f8529

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)