diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c index 27580d6f7..49583e913 100644 --- a/src/flash/nor/fespi.c +++ b/src/flash/nor/fespi.c @@ -676,7 +676,7 @@ void as_add_tx(struct algorithm_steps *as, unsigned count, const uint8_t *data) while (count > 0) { unsigned step_count = MIN(count, 255); assert(as->used < as->size); - as->steps[as->used] = malloc(step_count + 1); + as->steps[as->used] = malloc(step_count + 2); as->steps[as->used][0] = STEP_TX; as->steps[as->used][1] = step_count; memcpy(as->steps[as->used] + 2, data, step_count);