Skip to content
This repository has been archived by the owner on Sep 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #11 from sifive/malloc_off_by_1
Browse files Browse the repository at this point in the history
Correct off by 1 in malloc
  • Loading branch information
timsifive authored Dec 24, 2016
2 parents b474c22 + ddb4caf commit 193f630
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/flash/nor/fespi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 193f630

Please sign in to comment.