mirror of https://github.com/ARMmbed/mbed-os.git
Fix out-of-bounds array access in tests-mbedmicro-rtos-mbed-malloc
parent
1348db5af7
commit
5233eeae5b
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue